0

I'm write this code for show me point on google map in asp button event:

protected void Button1_Click(object sender, EventArgs e)
        {
            Page.ClientScript.RegisterStartupScript(this.GetType(), "beh", "isButtonClick=true;initialize(46.279637,35.123456);", true);
        }


but when i press the button i get this error:

Server Error in '/' Application.
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. 


what happen?

behzad razzaqi
  • 1,503
  • 2
  • 18
  • 33
  • possible duplicate of [Invalid postback or callback argument. Event validation is enabled using ''](http://stackoverflow.com/questions/228969/invalid-postback-or-callback-argument-event-validation-is-enabled-using-page) – Gábor Bakos May 22 '15 at 10:51

1 Answers1

0

If you have code in Page_Load(), enclosing it within if(!Page.IsPostBack){} would help. It makes sure controls are not recreated on every postback.

protected void Page_Load(object sender, EventArgs e)
{
if(!Page.IsPostback)
{
   //Your code
}
}
Chintan
  • 773
  • 9
  • 18