shuittny
asked on
pulling multiple dropdown values
does anyone know how to pull selected item values.......and values is the keyword from a dropdownlist?
I can use a request.form("fieldVal"), but that only pulls the id values of the field, not the text associated with the id. If we're talking about displaying values on pageB based on what the user selected on pageA.
I can use a request.form("fieldVal"), but that only pulls the id values of the field, not the text associated with the id. If we're talking about displaying values on pageB based on what the user selected on pageA.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
you question brings up a fundamental issue:
1. If you are passing values from one form to another and are not using Server.Transfer, Viggee's solution may apply.
2. However, you are providing a point in which things can be broken. Because you are providing both the id and value loosely and expect it to work.
It is better if at all possible, to store the list in the cache object and make it available:
1. If you are passing values from one form to another and are not using Server.Transfer, Viggee's solution may apply.
2. However, you are providing a point in which things can be broken. Because you are providing both the id and value loosely and expect it to work.
It is better if at all possible, to store the list in the cache object and make it available:
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Thus you can do it this way
C#
DataRow[] rows = ReferenceData.Instance.Cou ntries.Sel ect(string .Format("C OUNTRY_COD E = '{0}'","UK"));
if (rows != null && rows.Length == 1)
{
return rows[0]["COUNTRY_NAME"].To String();
}
VB.NET
====
Dim rows As DataRow() = ReferenceData.Instance.Cou ntries.Sel ect(string .Format("C OUNTRY_COD E = '{0}'","UK"))
If Not rows Is Nothing AndAlso rows.Length = 1 Then
Return rows(0)("COUNTRY_NAME").To String
End If
You can extend the ReferenceData class accordingly,
C#
DataRow[] rows = ReferenceData.Instance.Cou
if (rows != null && rows.Length == 1)
{
return rows[0]["COUNTRY_NAME"].To
}
VB.NET
====
Dim rows As DataRow() = ReferenceData.Instance.Cou
If Not rows Is Nothing AndAlso rows.Length = 1 Then
Return rows(0)("COUNTRY_NAME").To
End If
You can extend the ReferenceData class accordingly,
ASKER
http://authors.aspalliance.com/das/tutorial/listbox.aspx
I scrolled to 'Selecting Items In a Listbox'
That site has everything that I'm looking for. I'm able to pull values (the text that the user views on a listbox) from a listbox and then set that value to a hidden text field then submit the values to another page
I scrolled to 'Selecting Items In a Listbox'
That site has everything that I'm looking for. I'm able to pull values (the text that the user views on a listbox) from a listbox and then set that value to a hidden text field then submit the values to another page
DropDownList1.SelectedItem
RJ