Problem with HTMLSelect

G

Guest

I have an HTMLSelect server control that I am populating dynamically in the
Page_Load event of my page. When I turn off VIEWSTATE, the HTMLSelect.Value
property is blank when the page is posted back. Why is this? All of the
other controls on the page retain their values when the page is posted back
to the server.
 
B

Brock Allen

You need to repopulate the items in the select upon postback. The problem
is that the select stores the list of items in viewstate, so when the postdata
comes back in that item X was selected, there is no item X in the list. TextBoxes
don't need to store their Text in viewstate as it's part of the normal post.
Anyway, if you disable viewstate on that select, you'll have to manually
repop the items every request into the server.
 

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,744
Messages
2,569,483
Members
44,902
Latest member
Elena68X5

Latest Threads

Top