dropdownlistfor专题

《MVC》--用Razor给DropDownListFor绑定最近半年的时间

最近小编在做一个移动端的项目,有一个这样的需求,查询签到记录,并且根据DropDownListFor中绑定最近半年的时间,请看下面的实现代码。   前台代码 <h4 class="control-heading bg-info"><i class="glyphicon glyphicon-list-alt"></i> 查询打卡记录</h4><div id="selectMonth">

个别元素的绑定(%:Html.DropDownListFor()%)

<%:Html.DropDownListFor(x => x.ProvinceId, new SelectList((IEnumerable)ViewBag.Provinces, "Id", "Name"), "---请选择省份---")%>                     <%:Html.DropDownListFor(x => x.CityId, new SelectList((I