I have a marital status field in my users table that its just varchar yet I only want to give the users four options (married, single, widowed and divorced) and i want to have the correct one selected when Im editing the form.. is it possible? please help.
相关问题
- MVC-Routing,Why i can not ignore defaults,The matc
- how to get selected text from iframe with javascri
- parameters in routing do not work MVC 3
- dropdown <select> for list.js
- There is no ViewData item with the key 'taskTy
相关文章
- How to get a list of connected clients on SignalR
- How do you redirect to the calling page in ASP.NET
- Change color of bars depending on value in Highcha
- The program '[4432] iisexpress.exe' has ex
- ASP.Net MVC 4 Bundles
- How to get server path of physical path ?
- Cannot implicitly convert Web.Http.Results.JsonRes
- entity type has no key defined - Code first
This blog post should lead you in the right direction:
http://weblogs.asp.net/ashicmahtab/archive/2009/03/27/asp-net-mvc-html-dropdownlist-and-selected-value.aspx
you'd have to give us a little more information and maybe a code sample of what you have so far to get a more specific answer.
This should point you in the right direction:
Assuming that your model has a 'MaritalStatus' field,
will select the status of your model by default.