Help with asp.net mvc select dropdown -


I have a marital status area in my host table, which is not yet the only thing, only to users I want to give four choices (married), single, widow and divorced) and I want to make the right choice when I am editing this form. Is this possible? help please.

This will tell you in the right direction:

  & lt;% Select = (Html.DropDownList ("listName", new string [] {"married", "single", "widow", "divorced"} (m => New SelectListItem () {Selected = Model.MiritStats = = M, text = M, value = m})); & Gt%;  

Assuming that your model has 'MeritStats' field,

  selected = model. MeritalStatus == m  

By default, you will select the status of your model.


Comments

Popular posts from this blog

sql - dynamically varied number of conditions in the 'where' statement using LINQ -

asp.net mvc - Dynamically Generated Ajax.BeginForm -

Debug on symbian -