Link to home
Start Free TrialLog in
Avatar of panJames
panJames

asked on

C#, webmatrix, <select>

Hello experts.

I am using WebMatrix and C#.


To populate <select> tag I use the following code:

 <select id="abc">
      @foreach (var p in itemsFromQuery)
      {
            counter=counter + 1;
            <option id="@counter">@p.Name</option>
      }
      
</select>

It works fine.

Two questions:

1. How can I determine the index of option selected by user?
2. How can dynamically set an option with a selected index?

Thank you

panJames
ASKER CERTIFIED SOLUTION
Avatar of Mrunal
Mrunal
Flag of India image

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