views:

27

answers:

1

Hi, I have a view in MVC bound with model. Model is about person information. Itcontains a member for storing country. I have displayed the model information in a grid on view using an extension. I have created dropdown editor template for country for editing the person's country. But the problem is this drop down always shows the first entry as default selected for all persons. Whereas, I want respective person's country being selected.

Is there any way to achieve this?

Thanks, Kapil

A: 
<select>
 <option value="1" >first option</option>
 <option value="2" selected="selected">this option is selected</option>
</select>

you have to compare the stored value with the option value if true echo the 'selected part'

try looking here: http://stackoverflow.com/questions/624828/asp-net-mvc-html-dropdownlist-selectedvalue

FLY