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

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,822
Latest member
israfaceZa

Latest Threads

Top