Quick DropDownList of days/range with LINQ
@{
var days = Enumerable.Range(1, 31).Select(i => new SelectListItem
{
Text = i.ToString(),
Value = i.ToString()
});
SelectList source= new SelectList(days, "Value", "Text");
}
@Html.DropDownList("listId",source, "select")
Written by Ion D. Filho
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#.net
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#