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

.net - C# List<T>.Find(x=>x.Rectangle.Contains(Point)) FAIL -

iphone - Smoothing a rounded stroke in Core Graphics -

Best practice for URL redirection in ASP.NET web application -