How to handle Error Message:Operation is not valid due to the current state of the object.
This message as Operation is not valid due to the current state of the object occurs with the scenario when there are more no of postback keys, Which can be explained with the simple example.
I have a gridview with 128 rows and 13 columns with and every cell item has a TextBox Template Field.
After entering the details atleast in one of the textbox and immediately after clicking the save Button error will be raised as "Operation is not valid due to the current state of the object."
This is raised as ASP.NET requests that have lots of form keys, files, The Application log on the server has a Warning entry with a Source that is a specific version of ASP.NET, places a limit of 500 on postback items. The new default max introduced by the recent security update is 1000.
Solution for Error Message:Operation is not valid due to the current state of the object.
We have to increase the postback keys limit for that you have to fallow steps
2. Registry editor will be opened
3. Hkey_LOCAL_MACHINE/SOFTWARE/MICROSOFT/ASP.NET/[VERSNION]->Right Click the version
Select New->DWORD Value->name the DWORD to MaxHttpCollectionKeys.
4. Right click the MaxHttpCollectionKeys->decimal->enter the value as 2000 and save.
In the Web.config file
No responses found. Be the first to comment...