Visualizzazione dei risultati da 1 a 3 su 3

Hybrid View

  1. #1
    Utente di HTML.it L'avatar di mexican
    Registrato dal
    Oct 2001
    residenza
    cava de tirreni
    Messaggi
    3,541

    Invalid postback or callback argument.

    Ciao a tutti, ho questa eccezione al click su un button.
    come potete vedere da qui: http://www.raggioverdeweb.it/Concima...odulare-News-1

    cliccando su download si apre una modal e poi al click del button Download compare l'errore.

    Ho già letto che basta mettere EnableEventValidation="false", ma anche dopo averlo messo non cambia niente.
    Come posso risolvere?
    Grazie a tutti in anticipo.

  2. #2
    Moderatore di ASP.net L'avatar di djciko
    Registrato dal
    Nov 2002
    Messaggi
    6,887
    vedi se ti puo' essere d'aiuto questo calvario: (da stackoverflow)

    I had an experience with DataGrid. One of it's columns was "Select" button. When I was clicking "Select" button of any row I had received this error message:

    "Invalid postback or callback argument. Event validation is enabled using in configuration or <%@ Page EnableEventValidation="true" %> in a page. For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them. If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation."

    I changed several codes, and finally I succeeded. My experience route:


    1) I changed page attribute to EnableEventValidation="false". But it didn't work. (not only is this dangerous for security reason, my event handler wasn't called: void Grid_SelectedIndexChanged(object sender, EventArgs e)


    2) I implemented ClientScript.RegisterForEventValidation in Render method. But it didn't work.


    protected
    overridevoidRender(HtmlTextWriter writer)
    {
    foreach(DataGridItem item inthis.Grid.Items)
    {
    Page.ClientScript.RegisterForEventValidation(item.UniqueID);
    foreach(TableCell cell in(item asTableRow).Cells)
    {
    Page.ClientScript.RegisterForEventValidation(cell.UniqueID);
    foreach(System.Web.UI.Control control in cell.Controls)
    {
    if(control isButton)
    Page.ClientScript.RegisterForEventValidation(control.UniqueID);
    }
    }
    }
    }

    3) I changed my button type in grid column from PushButton to LinkButton. It worked! ("ButtonType="LinkButton"). I think if you can change your button to other controls like "LinkButton" in other cases, it would work properly.

  3. #3
    Utente di HTML.it L'avatar di mexican
    Registrato dal
    Oct 2001
    residenza
    cava de tirreni
    Messaggi
    3,541
    Quote Originariamente inviata da djciko Visualizza il messaggio
    vedi se ti puo' essere d'aiuto questo calvario: (da stackoverflow)
    Ciao alla fine ho risolto. Il problema era l'urlrewrite. Perchè al postback l'action del form non aveva la stessa firma.
    Quindi mi è bastato impostare l'action del form con la url riscritta.

Tag per questa discussione

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.