473,396 Members | 1,858 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Problem with HTMLSelect

Ken
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.
Nov 20 '05 #1
1 1553
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.

-Brock
DevelopMentor
http://staff.develop.com/ballen
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.

Nov 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: hash | last post by:
Hello, I have an <asp:table> control and inside this i am dynamically adding dropdownlists depending on values in the database. Whenever i try to bind any data to the HtmlSelect controls they...
0
by: Simon Johnson | last post by:
Dear all, I have a single htmlselect object in a usercontrol. I don't want to save the viewstate of that control because the number of elements in it is large. I do however, want to retain...
4
by: nospam | last post by:
HtmlSelect has a method called OnServerChange that supposed to detect whether the control (select) has changed on a postback. This is not all that useful. It should be like the asp.net...
2
by: Stephen Miller | last post by:
When I dynamically populate a HtmlSelect combo box, the Value property consistently fails to return the item selected, defaulting instead to the first item in the list. For example: Protected...
3
by: xenophon | last post by:
I created an HtmlSelect in my ASP.NET page template (setting runat="server" in its tag), double-clicked it in the Designer, and Visual Studio automagically made the declaration and Event Wireup and...
10
by: BK | last post by:
I'm having a really strange problem with and HtmlSelect server control (listbox) and a RequiredFieldValidator that I am trying to use to make sure that someone has items in the listbox. The way...
0
by: Zoodor | last post by:
I have a server control that contains an HtmlSelect. It currently uses postbacks to function (and works fine), but I am upgrading it to be able to use callbacks (using postback or callback,...
3
by: Joe | last post by:
Hello All, I am populating an HtmlSelect control's Items property with four list items. The HtmlSelect control is contained in a user control which is dropped into a placeholder on the web form....
1
by: writebrent | last post by:
This is my code: HtmlSelect m = new HtmlSelect(); m.ID = "m1"; m.DataSource = dvBasic; //DataView created elsewhere m.DataTextField = "value"; m.DataValueField = "key"; m.Value = "2";...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.