postback resetting checkbox state

C

Chris

I've got a gridview with a column of checkboxes. If I check off any
number of them, and perform a postback, they all go back to being
unchecked. What options do I have for getting around this?
 
C

Cowboy \(Gregory A. Beamer\)

Don't rebind the data in Page_Load every time. Use, for example, a If Not
Page.IsPostBack Then and only bind then. The viewstate is reconstituted
prior to Page_Load, so you will overwrite every time if you bind there.
 
C

Chris

Interesting, it seems that system.web.ui.webcontrols.button is the
culprit. If I put a 'select' control link in my gridview, that keeps
the checkboxes just fine. I wonder what the difference is?
 

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,818
Latest member
Brigette36

Latest Threads

Top