ASP.NET 2.0 EventValidation

When building an ajax enabled folder list view control, ran into a problem where i was clicking on the folder node, which caused a postback to the datagrid control. Trouble was then when i tried to operate on the datagrid control (sort, select) i was getting an error:

The state information is invalid for this page and might be corrupted.

After doing a lot of reading about it, this problem is caused by the event validation feature of ASP.NET 2.0. This is where the items in the datagrid are added to an event validation thingy, so that incorrect values can not be used to postback. Now i can solve it two ways, either by disabling eventvalidation it in web.config:

Or by registering each of the new items that i add to the datagrid for the callback so that event validation works correct:

I will see how easy it is added the validation, and hope that magicajax will correctly handle the updates. Otherwise i will just turn off the security feature as suggested here:

No comments: