[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

msnews.microsoft.com

2/5/2004 2:43:00 PM

The message is hinting that dynamic controls in the grid must be reloaded
during postback.

It is comman practice ( and i assume your doing it ) to put your databinding
inside "if(IsPostBack==false)" which is fine for the data. But if you have
dynamicly added controls, these have to be recreated for every postback.


"Ariel Gimenez" <arielgimenez@--sacar--esto--yahoo.com> wrote in message
news:OUFwre%236DHA.2404@TK2MSFTNGP12.phx.gbl...
> 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
>
>


1 Answer

Ariel Gimenez

2/5/2004 5:02:00 PM

0

Thanks Felbrigg!
I dont understand what you mean with dynamic controls in the grid must be
reloaded
during postback...
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 :(

thanks again
if u think you need more details im here to give it... just ask me

"Felbrigg" <someone@microsoft.com> wrote in message
news:e$dFdW$6DHA.1428@TK2MSFTNGP12.phx.gbl...
> The message is hinting that dynamic controls in the grid must be reloaded
> during postback.
>
> It is comman practice ( and i assume your doing it ) to put your
databinding
> inside "if(IsPostBack==false)" which is fine for the data. But if you
have
> dynamicly added controls, these have to be recreated for every postback.
>
>
> "Ariel Gimenez" <arielgimenez@--sacar--esto--yahoo.com> wrote in message
> news:OUFwre%236DHA.2404@TK2MSFTNGP12.phx.gbl...
> > 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
> >
> >
>
>