failed to load viewstate

A

Ariel Gimenez

Hello,
Can someone helpme?
I have a datagrid in wich im using column templates for the edit command, with comboboxes.
The datagrid works fine for the first time i execute the edit command but the second time it gives me the following error...

Failed to load viewstate. The control tree into which viewstate is being loaded must match the control tree that was used to save viewstate during the previous request. For example, when adding controls dynamically, the controls added during a post-back must match the type and position of the controls added during the initial request.

any help will be appreciated
Thanks in adfance
Ariel Gimenez
 
E

Earl Teigrob

Ariel

By the error, it sounds like you may be dynamically adding or removing controls to/from you datagrid during a non-postback and then not rebuilding them on postback. If this was the case, then viewstate could get mixed up and generate an error. More info (or code) on what you are doing related to this may help isolate the problem.

Earl
Hello,
Can someone helpme?
I have a datagrid in wich im using column templates for the edit command, with comboboxes.
The datagrid works fine for the first time i execute the edit command but the second time it gives me the following error...

Failed to load viewstate. The control tree into which viewstate is being loaded must match the control tree that was used to save viewstate during the previous request. For example, when adding controls dynamically, the controls added during a post-back must match the type and position of the controls added during the initial request.

any help will be appreciated
Thanks in adfance
Ariel Gimenez
 
A

Ariel Gimenez

Thanks Earl !
Unfortunatelly, im not adding controls manually, i just using column templates, in these
columns i have changed for the edit command the textbox with a dropdowlist,
and in the item databound event im retrieving these selected values with
findcontrol and calling stored procedures in order to update the db...
First time all works fine, but in some cases (im doing a kind of validation
in the update command) i need to refire this update command and in this case
is when im getting the stinking message :(

Ariel

By the error, it sounds like you may be dynamically adding or removing controls to/from you datagrid during a non-postback and then not rebuilding them on postback. If this was the case, then viewstate could get mixed up and generate an error. More info (or code) on what you are doing related to this may help isolate the problem.

Earl
Hello,
Can someone helpme?
I have a datagrid in wich im using column templates for the edit command, with comboboxes.
The datagrid works fine for the first time i execute the edit command but the second time it gives me the following error...

Failed to load viewstate. The control tree into which viewstate is being loaded must match the control tree that was used to save viewstate during the previous request. For example, when adding controls dynamically, the controls added during a post-back must match the type and position of the controls added during the initial request.

any help will be appreciated
Thanks in adfance
Ariel Gimenez
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,780
Messages
2,569,608
Members
45,247
Latest member
crypto tax software1

Latest Threads

Top