I keep getting this error:
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 have registered the ClientScriptMagner.Regis.... but still nothing.
I have dropdownlist's in a control and when my form is submitted, this happens.
How do I fix this?
I think that this is happening because you are changing anything behind the scene. might be to use cascading dropdowns or something that is changing the original state of the page.
Not exactly the perfect solution but it works:
in your aspx Page directive to false entry EnableEventValidation change.
EnableEventValidation = "false"
Hope that Helps
Related
I have a listbox which is part of a composite control.
I add items by javascript. If I submit without selecting items(click on one or more of them), it works fine, but if I click on one of the items, it causes the following error.
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 tried to register some possible values using Page.ClientScript.RegisterForEventValidation and it works fine for that values(in case when I selected one of them). So if I register all possible values, then i won't have problems. But the possible values are about 29000 int values.In my opinion, calling a service to get and register values is not a good solution.
Is there any other approach to solve this?
I've got a .ascx server control in ASP.NET 2.0 that contains several other .ascx server controls. Everything in the top-level one is wrapped in an UpdatePanel. It works great until the second time I do something on the page, and then I get this error in an alert dialog:
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.
This seems like a common error; a Google search turns up several results. They all seem to say that if a postback happens, you have to make sure to call Update on any UpdatePanels that contain controls that were updated. But when I'm debugging this my whole page is contained inside one UpdatePanel (whose UpdateMode is Always), so that doesn't seem right. What's going on?
I know why it's happening and i turned the validation off on the page level, but is there a way to turn it off on the control level?
"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."
look this post.
Invalid postback or callback argument. Event validation is enabled using '<pages enableEventValidation="true"/>'
in this, i've used Subclass ListBox method. it works...
Using ASP.NET VB, I have a form with some text boxes and a Gridview. If a user clicks the Edit button on a row in the gridview, and then tries to submit the form with a row still in edit mode on the Gridview, this error is generated -
"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. "
Any idea how to prevent this error??
just go to web.config and make it false.
i also face that error and i fixed it by doing this.
check these link as reference
http://www.c-sharpcorner.com/Forums/ShowMessages.aspx?ThreadID=35528
http://channel9.msdn.com/forums/TechOff/155642-Invalid-postback-or-callback-argument-Wants-event-validation-enabled/
check my answer if you get your answer and vote it.thanx
I've used the following in web.config
<pages enableEventValidation="false">
This corrects a problem we've been having with Ajax.
We have a web page that if you browse to directly using a standard HTML hyperlink works fine.
If you browse to the page from another page via link inside a gridview and response.redirecting in the RowCommand event to the page passing an ID in the querystring. The page throws errors from controls inside the panel stating
"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'm happy to leave the page validation as false as it seems to have had no other effect.
Any ideas what's happening?
Read the documentation.
EDIT: For security reasons, it's probably best to leave it set to true wherever you can.
I would therefore recommend that you set it to false only on the individual AJAX pages where it causes problems, while leaving it true in web.config.
From here
Invalid PostBack or CallBack argument error is basically raise because of Event Validation feature. The EventValidation feature is a new feature in ASP.NET 2.0, and provides an additional level of checks to verify that a postback from a control on the client is really from that control and not from someone malicious using something like a cross-site script injection to try and manipulate things. It is part of our overall strategy of increasingly adding security in depth levels to the programming model -- so that developers can be secure by default even if they forget to add security checks of their own.
Now, Invalid PostBack or CallBack argument error may occur when you are firing click event and the object is rebinding or its properties are changed in Page_Load event or someone is trying to hack into your system with cross site scripting. Each time .Net Framework render a page then it associate a unique Guid for all the controls. When binding a gridview or repeater, on each databind framework will associate a new guid for the contorl. So every time when you are firing event make sure Page_Load event does not change the control, because if the control changed the it will have a different Guid which have acutally fired the event for postback. Here are some scenario with this error.
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.
There is one thing worth adding here: If you want to disable the event validation for a specific control, rather than the entire page, there is a workaround documented here and here (and now referenced in the relevant Connect suggestion):
Simply subclass the relevant WebControl class, and don't set the SupportsEventValidation attribute on the subclass. The subclass will be exempt from event validation.