iwqfuw
Last Updated: February 25, 2016
·
811
· iondrimba
178548

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")
Say Thanks
Respond