Link to home
Start Free TrialLog in
Avatar of panJames
panJames

asked on

<select> how to get id of selected item?

Hello experts!

I have <select> list populated dynamically:

<select id="feat1" name="feat1" title="feat1">
@foreach (var p in featQuery)
{
  counter=counter + 1;
  <option id="@counter">@p.Name</option>
}
</select>

How can I retrieve id number of option selected by user?

To get a option I use:

value = Request.Form["feat1"];

But I do not need string, I need id here.

Thank you

panJames
ASKER CERTIFIED SOLUTION
Avatar of cbtahir2001
cbtahir2001

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
Avatar of panJames
panJames

ASKER

Forgot to mention: it needs to work/ cooperate with WebMatrix code.

panJames