Hello. I have a web page with a user control. In the user control, I have a variety of labels, drop down lists, and check box lists. I have some 'main' controls, which hold data that the user will enter. I have some 'secondary' controls, which will display
the data from the previous time data was entered. The problem is this.: The values for the checkboxlists in the secondary controls are being lost when I hit the save button. Yet the data in the main controls are fine. Also, it is only the checkbox lists that
are losing their value, the labels are fine. All of these controls are being filled when Postback is true: (quick and dirty version of the code) --------------- Sub Page Load If Not IsPostBack getData()'Fill primary controls getPreviousAnswers() 'secondary
controls End If End Page Load Sub btnSave click Event 'run some validation here End Sub ------------ On the click of Save, the code goes through the page load, skips the section with the conditional, and then goes to the save subroutine (ok so far). The problem
is, when I go through the debugger, by the time it gets to the save code from page load, the values for the secondary checkboxlists have been lost, but the labels are fine. The primary controls are also fine. I don not understand why at all....am I missing
something. All of the controls have their EnableViewState = True. Thanks, and I hope this isnt a dumb question.
Hello. Sorry to have not visited in a while. Very rude of me. The problem was that the checkbox lists (the secondary ones) were set to Enabled=False. Turns out on postback, disabled controls dont maintain their view state. I learn something new everyday...
sensoukami
Member
162 Points
42 Posts
checkboxlist values lost, but why?
Jul 17, 2003 06:43 PM|LINK
joteke
All-Star
46284 Points
6896 Posts
ASPInsiders
MVP
Re: checkboxlist values lost, but why?
Jul 18, 2003 09:01 AM|LINK
Teemu Keiski
Finland, EU
sensoukami
Member
162 Points
42 Posts
Re: checkboxlist values lost, but why?
Aug 31, 2003 02:45 AM|LINK