zoukankan      html  css  js  c++  java
  • MVC动态绑定下拉框

    Controller:
    1//获取下拉信息表
    //_vendorsAppService.GetAllObj() 是获取下拉列表结果集
    2 ViewData["vendlist"] = new SelectList(_vendorsAppService.GetAllObj(), "Id", "Name", dto.VendorsId);
    
    View:
    <div class="form_group fl">
    <label class="gry fl">供应商:</label>
    @Html.DropDownList("sVendorsId", ViewData["vendlist"] as IEnumerable<SelectListItem>, new { @class = "btn dropdown-toggle form-control" })
    </div>

    或者
    Controller:

      WithdrawalsApplyDto dto = new WithdrawalsApplyDto();
      IEnumerable<SelectListItem> selList2 = TxEnumHelper.EnumToListItem(typeof(WithdrawalsApplyDto.StateWithdrawalsApply), dto.State);
      ViewData["State"] = selList2;

    View:
    <div class="form_group fl">
    <label class="gry fl">供应商:</label>
    @Html.DropDownList("DDLState", ViewData["State"] as IEnumerable<SelectListItem>, new { @class = "btn dropdown-toggle form-control" })
    </div>
     

      

  • 相关阅读:
    powerdesigner
    UML类图几种关系的总结(转载 http://blog.csdn.net/tianhai110/article/details/6339565 )
    vuex
    options请求(复杂请求)
    Vue 编程式的导航
    JS定义类
    cors中间件
    vue axios
    restframewor 版本(version)
    pycharm 安装vue
  • 原文地址:https://www.cnblogs.com/lxyang/p/7899605.html
Copyright © 2011-2022 走看看