postback resetting checkbox state

  • Thread starter Thread starter Chris
  • Start date Start date
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?
 
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.

--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA

Subscribe to my blog
http://gregorybeamer.spaces.live.com/lists/feed.rss

or just read it:
http://gregorybeamer.spaces.live.com/

*************************************************
| Think outside the box!
|
*************************************************
 
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?
 
Back
Top