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</opt ion>
}
</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
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</opt
}
</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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.