The Design of Software (CLOSED)

A public forum for discussing the design of software, from the user interface to the code architecture. Now closed.

The "Design of Software" discussion group has been merged with the main Joel on Software discussion group.

The archives will remain online indefinitely.

Accessing Field Value of selected DropDown List Record

I'm using Visual Web Develper Express to develop a web application, and have created a dropdown list on a form with the id DDL. My data source DS uses a single table T with all three of its fields selected for use in the SQL statement. Field F1 is used for the value, field F2 is used for the displayed name, and field F3 is not used for the list. I've created a handler for when a new selection is made, but I need to store the value of F3 in a session variable and cannot figure out how to access the value of F3 in the selected row. I'm new at this (obviously) and any help would be appreciated. Thanks
Robert Lerner Send private email
Monday, September 25, 2006
The web is stateless.

Your DropDownList control and DataSource exist on the server only. When your page is rendered, your DDL is converted into an HTML select element. The option elements have display text and value attributes. F3 does not exist at this point - therefore, on postback there is no way to retrieve it without first re-binding your data and figuring out which F3 was associated with the selected value, F1.

You might want to use a GridView instead, and set F3 as one of the DataKeyNames.
redeye Send private email
Tuesday, September 26, 2006
redeye - thank you very much. That makes it clear why what I thought should be easy is not.
Robert Lerner Send private email
Tuesday, September 26, 2006

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics
Powered by FogBugz