This is a migrated thread and some comments may be shown as answers.

Invalid postback or callback argument.

23 Answers 2916 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
balaji
Top achievements
Rank 1
balaji asked on 24 Jun 2009, 07:29 AM
Hey people,
now ive tried to use the radajax panel at a certain time am getting the error as
"Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerServerErrorException: Invalid postback or callback argument.  Event validation is enabled using <pages enableEventValidation="true"/> 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 find no actions take place if i click enableevent validation="false"

a)may i knw what is the cause of this error?
b)In Most of the Telerik Demo i find that they have been using sql datasource to bind data to the controls rather than code behind,wuld that be the reason for it?

Guys this is getting so serious and close pls just give me hint and ill be so greatfull to you all.
Awaiting for your Swift Reply
Thanks
Regards
N.Balaji

23 Answers, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 24 Jun 2009, 10:15 AM
Hello Balaji,

Could you please elaborate a bit  more? Any information on your scenario may be of help on resolving that.
It will be best to isolate the issue  in a sample and open a support ticket where you can send that. Thus we could do our best to help you in resolving the problem.

Basically the problem you are facing is caused of abnormal change of the ViewState during postbacks. Event validation checks the incoming values in a POST to ensure the values are recognized. In other words, saved hash values in the __EVENTVALIDATION are different from these send through POST method.

One of the possible, solution is to disable event validation.
Change this line:    
     
<@Page ... enableEventValidation="true"  />    
    
To:    
    
<@Page ... validateRequest="false" enableEventValidation="false" /> 

Regards,
Pavlina
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
balaji
Top achievements
Rank 1
answered on 24 Jun 2009, 10:36 AM
Hi there thanks for your swift reply.
But you knw while adding those two lines such as page enable event validation and validate request.
I dont find anything happen my page is getting refreshed.
and is there any pther way to send zip attachment kindly pls help me coz am not affordable
Thanks

0
Pavlina
Telerik team
answered on 24 Jun 2009, 01:04 PM
Hi Balaji,

I am afraid that the provided information is not enough to determine what have caused the unexpected behavior.At this point I will ask you to open a formal support ticket and send us a simple running project demonstrating the problem (and step-by-step instructions on doing so). In that way we can reproduce and pinpoint the problems you're facing on our side, understand the logic of your application and provide a solution.

Regards,
Pavlina
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Karl
Top achievements
Rank 1
answered on 07 Oct 2010, 07:47 PM
I have a RadGrid in a RadPanelBar which produces the same error.

If I leave the page tag at the top of my page to read...

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="RadControlTests._Default" EnableEventValidation="true"  %>

and use the built-in navigation arrows (not the page numbers, they work fine!) for my paged RadGrid, I get the following error...

Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerServerErrorException: Invalid postback or callback argument.  Event validation is enabled using <pages enableEventValidation="true"/> 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.

but if I change my page tag to read...

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="RadControlTests._Default" ValidateRequest="false" EnableEventValidation="false"  %>

I no longer get the error, but the navigation arrows fail to navigate and nothing happens. Again, the page number navigation works ok.






0
Pavlina
Telerik team
answered on 11 Oct 2010, 09:47 AM
Hi Karl,

Can you please make sure that EnableViewState property of the RadGrid / MasterTableView is set to true? Paging with disabled control ViewState is not supported.
http://www.telerik.com/help/aspnet-ajax/grdviewstateoptimization.html

Best wishes,
Pavlina
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
joe
Top achievements
Rank 1
answered on 12 Oct 2010, 04:19 PM
i am having the exact situation as Karl, i have a rad grid with paging, sql datasource, ....
paging works fine as long as i choose the page numbers, but using the graphic controls with the arrows always results in

Invalid postback or callback argument.  Event validation is enabled using <pages enableEventValidation="true"/> 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.

 

the property of the RadGrid / MasterTableView is set to true as recommended.

i have done everything recommended on this page, but not positive results.

0
Pavlina
Telerik team
answered on 14 Oct 2010, 02:38 PM
Hello joe,

Can you verify that the page ViewState is enabled?

Kind regards,
Pavlina
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
joe
Top achievements
Rank 1
answered on 14 Oct 2010, 03:02 PM
the viewstate is enabled for the radgrid
0
Pavlina
Telerik team
answered on 15 Oct 2010, 08:41 AM
Hello Joe,

I am sending you a simple working project that is working as expected. Please give it a try and let me know if it helps to resolve the problem. 

Greetings,
Pavlina
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Karl
Top achievements
Rank 1
answered on 29 Oct 2010, 04:36 PM
Thanks Pavlina,

I had a look at the grid definiation and the code behind in your example and implemented it into my grid and it works well. Everything seems to work as it should now.

I think its a bit odd that some of the functionality of the grid seems to fail if you bind data in the normal way though, rather than on demand.

Karl
0
Pavlina
Telerik team
answered on 01 Nov 2010, 04:18 PM
Hi Karl,

Can you please specify what exactly do you mean by  "bind data in the normal way"? For more information about how to use simple data binding with a RadGrid control, I suggest that you examine this help article.

Kind regards,
Pavlina
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Karl
Top achievements
Rank 1
answered on 01 Nov 2010, 04:24 PM
RadGrid1.DataSource = MyDataSource;
RadGrid1.DataBind();
0
Pavlina
Telerik team
answered on 01 Nov 2010, 05:16 PM
Hi Karl,

Note that with this type of binding you need to change the sort direction and switch the pages manually as you will do with the standard MS GridView control in the same scenario.

If you would like these actions to be performed automatically, consider using advanced binding with NeedDataSource event handling.

Greetings,
Pavlina
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Aaron
Top achievements
Rank 2
answered on 04 Nov 2010, 04:28 PM
I had this issue, but in my case was due to a mistake during my page load, in my case, i was doing the databinding every time the page was loading, so, if i triggered a button inside the grid, since it rebinded again in page load, then the control triggering the event was lost, after fixing that, i resolved this issue.
0
ala
Top achievements
Rank 1
answered on 25 Dec 2010, 11:50 PM
Hi Aaron,

could you please explain me how you solved your problem.I am also getting the same error by rebinding the grid on each post back.
0
Udo
Top achievements
Rank 1
answered on 21 Jan 2011, 02:03 PM
I had the same Problem and the solution was simple (although it took me a long time):

In the Page_Load event I was selecting data for the grid in this way:

Me.MyObjectDataSource.SelectParameter("...").DefaultValue = ...
Me.MyObjectDataSource.Select()

It is important NOT to do this if PostBack is active! So the right way is this:

If IsPostBack = False Then
    Me.MyObjectDataSource.SelectParameter("...").DefaultValue = ...
    Me.MyObjectDataSource.Select()
End If



0
Nicolas
Top achievements
Rank 1
answered on 15 Nov 2011, 06:45 PM
In my case, i was calling the RadGrid.Rebind function in my page_load event:

If(IsPostback)
{
    RadGrid1.Rebind()
}

When I moved the function call into an event handler after the page_load, like a checkbox_CheckedChanged event, evetything went fine.
0
christian
Top achievements
Rank 1
answered on 30 Nov 2011, 05:29 PM
yes, solved it!

the event can be 'dataneeded' event:

 protected void RadGrid_OnDataSourceNeeded(object sender, EventArgs e)
        {
           DataTable table = GetTableFromCache();
           RadGridSchadePremieRapport.DataSource = table;
       //now no rebind() or databind() !
        }
0
Larry
Top achievements
Rank 1
answered on 29 Mar 2012, 09:59 PM
I just wanted to export a table to Excel using the built-in Export to Excel feature.  I got the same Invalid postback or callback argument error when clicking on the Export to Excel button (a standard feature of the RadGrid).  So, I tried the so called "Advanced Binding" technique (LOL). I can dynamically change the data in the RadGrid but the grid need to be Data bound to see changes. 
The following works without setting ValidateRequest="false".  I load the Session during the Page_Load.

protected void rgEmployees_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)

        {

           //no databind needed

            if (rblYearSelect.SelectedValue == "thisYear")

            {

                DataTable employeeDataTable = (DataTable)Session["ThisYearDataTable"];

                rgEmployees.DataSource = employeeDataTable;

            }

            else

            {

                DataTable employeeDataTable = (DataTable)Session["PriorYearDataTable"];

                rgEmployees.DataSource = employeeDataTable;

            }

        }

        protected void rblYearSelect_SelectedIndexChanged(object sender, EventArgs e)

        {

            if (!isLoading)

            {

                //do databind as needed

                if (rblYearSelect.SelectedValue == "thisYear")

                {

                    DataTable employeeDataTable = (DataTable)Session["ThisYearDataTable"];

                    rgEmployees.DataSource = employeeDataTable;

                    rgEmployees.DataBind();

                 }

                else

                {

                    DataTable employeeDataTable = (DataTable)Session["PriorYearDataTable"];

                    rgEmployees.DataSource = employeeDataTable;

                    rgEmployees.DataBind();

                }

            }

        }


0
Daniel
Telerik team
answered on 03 Apr 2012, 09:44 AM
Hello Larry,

Judging by the provided description it seems to me that your export button is ajaxified. In this case, please examine the following link:
Export from Ajaxified Grid

Regards,
Daniel
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Ganapathy
Top achievements
Rank 1
answered on 26 Sep 2012, 08:58 PM
validateRequest="false" enableEventValidation="false"

Setting the above at page level fixed my issue.
0
Abdifatah
Top achievements
Rank 1
answered on 07 Jun 2018, 05:28 AM
Thanks Alot it Work
0
Rutuja
Top achievements
Rank 1
answered on 20 Mar 2019, 10:37 AM
thank u
Tags
Ajax
Asked by
balaji
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
balaji
Top achievements
Rank 1
Karl
Top achievements
Rank 1
joe
Top achievements
Rank 1
Aaron
Top achievements
Rank 2
ala
Top achievements
Rank 1
Udo
Top achievements
Rank 1
Nicolas
Top achievements
Rank 1
christian
Top achievements
Rank 1
Larry
Top achievements
Rank 1
Daniel
Telerik team
Ganapathy
Top achievements
Rank 1
Abdifatah
Top achievements
Rank 1
Rutuja
Top achievements
Rank 1
Share this question
or