Error: Invalid postback or callback argument

后端 未结 5 1146
無奈伤痛
無奈伤痛 2020-12-18 07:05

I am getting the following error on a button click with gridview

 Server Error in \'/\' Application.
Invalid postback or callback argument.  Event validation         


        
相关标签:
5条回答
  • 2020-12-18 07:48

    1) Invalid Postback or Callback argument in GridView Problem may be: You are binding data in Page_Load event with either Object Data Source or Manual Binding with function call. This will make your GridView bind data on every event fire of any control.

    When you are firing any GridView command with OnRowCommand, before RowCommand fire your GridView will rebind and all control within it will be assigned to new id. So RowCommand could not get the item which have fired the event.

    Solution for Invalid Postback or Callback argument in GridView: You can bind your data within this if condition

    if (!IsPostBack)
    {
        //Your code for Bind data 
    }
    

    This code will definitely give you solution if this not work then check whether any other control is not giving error.

    0 讨论(0)
  • 2020-12-18 07:54

    A few things to try

    1. In your Page Load event, add a check for !Page.IsPostBack and move the non-authenticating code block there.
    2. Experiment using a LinkButton instead of a regular button.
    0 讨论(0)
  • 2020-12-18 07:58

    I testing all above solutions and other posts but my problem isn't done.

    My problem was solved when cancel event at end of grid event at server side.

    This type of problem occurred when we using edit event of gridview. just add e.Cancel = true; at the end of event.

    protected void grdEducation_RowEditing(object sender, GridViewEditEventArgs e)
    {
      // do your processing ... 
    
      // at end     
      e.Cancel = true;
    }
    
    0 讨论(0)
  • 2020-12-18 08:05

    This could be because of any third party controls you are using.

    I also had this error. In my case i have a repeater control inside updatepanel and inside repeater control i was using telerik datepicker control. It was working fine in IE but not in mozilla and chrome. I examined the form data in both the cases by sending request from chrome and IE and found that the triggring control values are slightly different. i used telerik RadAjaxmanager instead of updatepanel the error gone.

    0 讨论(0)
  • 2020-12-18 08:06

    are you updating the Grid or any such control through javascript or Ajax.

    If this is the case then you might face this. Possible solution can be to set EnableEventValidation to false.

    0 讨论(0)
提交回复
热议问题