will checkboxes lose their state after postback?

J

Jimmy

Hi

I have build a datalist with checkboxes in it and after a postback the state
of the checkboxes have not been saved. I have enabled the viewstate of all
the controls on this page. What do I have to implement to keep the state?

ch Jimmy
 
S

Scott M.

Are these checkboxes bound to a data source? If so, have you updated the
data source in the postback and re-bound the datalist to the data source?
 
J

Jimmy

Scott
They are not bound to a datasource...
In this case the viewstate does not take care of this? So I have to write
code to put the values of the (un)checked boxes back?

Ch Jimmy
 
L

Lau Lei Cheong

Yes, you seems to have to override the SaveViewstate and LoadViewstate
method in order to reload the value.

..NET framwork will not take care of them because to the framwork, they are
essentially something recreated(i.e.: they are not the origional checkboxes
after postback, they're just another group of checkboxes that process the
same ID as the destroyed ones)
 

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,995
Messages
2,570,230
Members
46,817
Latest member
DicWeils

Latest Threads

Top