Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP.NET - Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerServerErrorException: Invalid postback or callback argument

I don't understand why this happens. I added the following code into my ASP.NET project and it worked just fine several days ago. I then continued on working on the page until today I tried clicking the "Verify" button from the code below and here's what happens:

First this is the asp.net code:

<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
 <ContentTemplate>
  <asp:TextBox ID="TextVerifyName" runat="server" CssClass="input1" EnableViewState="false"></asp:TextBox>
  <asp:Button ID="ButtonVerifyName" runat="server" Text="Verify" CssClass="checkButton" onclick="ButtonVerifyName_Click" />
  <asp:UpdateProgress ID="UpdateProgressVerifyName" runat="server" AssociatedUpdatePanelID="UpdatePanel1">
   <ProgressTemplate>
    <img src="Graphics/spinner.gif" alt="Please wait" />
   </ProgressTemplate>
  </asp:UpdateProgress>
 </ContentTemplate>
</asp:UpdatePanel>
  1. The first time I click the "Verify" button the code works fine.
  2. The second time I run it I get the following error:

Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerServerErrorException: 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.

Can someone explain why is this happening because the error message above is nothing more than 100% confusing???
I haven't done anything with ClientScriptManager.RegisterForEventValidation method.

like image 548
ahmd0 Avatar asked May 12 '26 11:05

ahmd0


2 Answers

Try putting any function/binding you have specified in the page_load event inside

if(!IsPostback)
{

}

It may help.

like image 190
Karthik Avatar answered May 14 '26 20:05

Karthik


Indeed, I was loading data in the Page_Load method but what was weird was that when you click on a grid that had a leaping commandColumn runtime error javascript. The solution was the

(! IsPostBack)
{
/ / loadData
}
like image 25
christianMorante Avatar answered May 14 '26 20:05

christianMorante



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!