Link to home
Start Free TrialLog in
Avatar of shuittny
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.

Avatar of riyasjef
riyasjef

Like this

DropDownList1.SelectedItem.Text;

RJ
SOLUTION
Avatar of Viggee
Viggee

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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:


ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thus you can do it this way
C#
DataRow[] rows = ReferenceData.Instance.Countries.Select(string.Format("COUNTRY_CODE = '{0}'","UK"));
if (rows != null && rows.Length == 1)
{
  return rows[0]["COUNTRY_NAME"].ToString();
}

VB.NET
====
Dim rows As DataRow() = ReferenceData.Instance.Countries.Select(string.Format("COUNTRY_CODE = '{0}'","UK"))
If Not rows Is Nothing AndAlso rows.Length = 1 Then
  Return rows(0)("COUNTRY_NAME").ToString
End If

You can extend the ReferenceData class accordingly,
Avatar of shuittny

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