|
Rank: Advanced Member Groups: Member
Joined: 3/9/2010 Posts: 119
|
I have a grid - running mode: client, full row select: true. It has and edit column, 2 datepicker columns, and a custom column containing a dropdownlist. When I click the edit link the row goes into edit mode with no problem but when I click update or cancel I get the following exception.
Exception: 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. at System.Web.UI.ClientScriptManager.ValidateEvent(String uniqueId, String argument) at System.Web.UI.Control.ValidateEvent(String uniqueID, String eventArgument) at System.Web.UI.WebControls.DropDownList.LoadPostData(String postDataKey, NameValueCollection postCollection) at System.Web.UI.WebControls.DropDownList.System.Web.UI.IPostBackDataHandler.LoadPostData(String postDataKey, NameValueCollection postCollection) at System.Web.UI.Page.ProcessPostData(NameValueCollection postData, Boolean fBeforeLoad) at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
any ideas what could be causing this error?
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,196
|
Hi,
This would indicate a problem somewhere. You would get this error if you have a server control that has not registered as an event source during the initial page load stage but when the page posts back, it indicates that there is a server event for that control. The Grid should not cause a server event when Update button is clicked. So it should not even go back to the server side, let alone to trigger a "wrong" event.
You may want to try to isolate the problem into a test page and see if you can identify what triggered the problem for you. If you have isolated the problem and still can not identify the trigger, you can either post your test page here or email it to us. We will take a look as soon as we have that.
Thanks!
|
|
Rank: Advanced Member Groups: Member
Joined: 3/9/2010 Posts: 119
|
I tracked down the problem. When the edit button is clicked it is causing the window.onbeforeunload event to fire. I have a callback in the function connected to this event to write back any changes to the grid data if the user navigates away to prevent data loss. Any idea why this event would be triggered?
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,196
|
Hi,
You can try to create a separate page, or compare your page with our sample project to see if you can find out what triggered the problem. The Grid edit button should not trigger window.onbeforeunload.
Thanks!
|
|
Rank: Advanced Member Groups: Member
Joined: 3/9/2010 Posts: 119
|
I found the true culprit and it was that I was changing the options collection on the custom column's dropdownlist on the client side because the options list is conditional and may not be the same for each gridItem. Is there a way to load the dropdown list conditionally to avoid this situation?
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,196
|
Hi,
In that case please do not use a server control for the option list but use a <select> element directly.
Thanks!
|
|