hey guys im facing a weird problem, would appreciate sme help:
I
have created a datagrid that displays user info stored in a Database.
The user can also edit his personal info on the datarid right away by
clicking on Edit link (this is a button column in the datagrid that ive
created, and of course all other columns that contain the info are
bound columns that retrieve the data in SQL database.
Now I
have created this web page in project1 but then i created another
project "project2" and chose include this web page in the latter.
Weirdly, in the first project everything works fine when testing the
web page (i.e the user can click on edit and actually edit the info)
however in project2 whenever i click on Edit i get this error page:
Server Error in '/website' 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.
Description:
An unhandled exception occurred during the execution of the current web
request. Please review the stack trace for more information about the
error and where it originated in the code.
Exception Details:
System.ArgumentException: 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.
Source Error:
An
unhandled exception was generated during the execution of the current
web request. Information regarding the origin and location of the
exception can be identified using the exception stack trace below.
Stack Trace:
[ArgumentException:
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.]
System.Web.UI.ClientScriptManager.ValidateEvent(String uniqueId, String argument) +2079737
System.Web.UI.Control.ValidateEvent(String uniqueID, String eventArgument) +106
System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String eventArgument) +32
System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +174
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5102
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.26; ASP.NET Version:2.0.50727.26
i
have made sure everything is the same as in project1 and everything is
in place. I dont know what is different + i have tried copying and
pasting this statement <pages enableEventValidation="true"/> in
the web.config file just in case it is the prob but it did nthg. I
still get this error page no matter what. Could it be sthg in the
settings that i could be missing
thanks for the help
Susan

DataGrid
Etienne2005
Grant Holliday
babarzhr
I found your post because I have the same problem. I found a work around though. If you add < xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
ButtonType="LinkButton" instead of ButtonType="PushButton"
to your asp:EditCommandColumn tag, then the problem seems to go away. Interestingly I also tried EnableViewState="false" and the edit button worked but then the update and cancel buttons would only fire the code set under OnEditCommand and not their respective code(OnUpdateCommand and OnCancelCommand). Good Luck.
mobigital
You need to do two things. First override the Render method like in the following example:
Protected Overrides Sub Render(ByVal writer As System.Web.UI.HtmlTextWriter)Page.ClientScript.RegisterForEventValidation(
"listFilter") MyBase.Render(writer) End SubReplace "listFilter" with the id of your button that you are using. This will validate your control button during the postback.
If you are doing a callback you will also need to add the following line in your RaiseCallbackEvent method.
Page.ClientScript.ValidateEvent(
"listFilter")Again replace "listFilter" with the id of the button you are using. Add this inside a Try...Catch block and before you do anything else.
Hope this helps.
Gondore