zoukankan      html  css  js  c++  java
  • MVC 下拉單數據內容綁定

     #region
            /// <summary>授權範圍自建列表</summary>
            /// <returns></returns>
            public static List<SelectListItem> GetBookSourceSelectList()
            {
                List<SelectListItem> BookSourceSelectList = new List<SelectListItem>();
                BookSourceSelectList.Add(new SelectListItem() { Value = "1", Text = "雄獅旅遊" });
                BookSourceSelectList.Add(new SelectListItem() { Value = "2", Text = "雄獅資訊" });
                BookSourceSelectList.Add(new SelectListItem() { Value = "3", Text = "雄獅通運" });
                BookSourceSelectList.Add(new SelectListItem() { Value = "4", Text = "雄獅杏林事業" });
                BookSourceSelectList.Add(new SelectListItem() { Value = "5", Text = "欣傳媒" });
                BookSourceSelectList.Add(new SelectListItem() { Value = "6", Text = "傑森全球整合行銷" });
                BookSourceSelectList.Add(new SelectListItem() { Value = "7", Text = "雙獅聯合" });
                BookSourceSelectList.Add(new SelectListItem() { Value = "8", Text = "欣聯航" });
                BookSourceSelectList.Add(new SelectListItem() { Value = "9", Text = "其他" });
                return BookSourceSelectList;
            }
            #endregion

    前台調用方法:

    @Html.DropDownListFor(m => m.Book.BookAuditorSource, Model.BookSourceList, "請選擇", new { id = "sel_BookSource", @class = "input-medium", onchange = "GetBookAuditorName()" })

  • 相关阅读:
    VMware 8安装Mac OS X 10.7 Lion正式版
    linq to sql sum
    拍照,去相册剪切图片
    Binding for WPF Styles
    JDK1.8简单配置环境变量两步曲
    hibernate系列之四
    idea中使用逆向工程三部曲
    hibernate系列之一
    hibernate系列之二
    《JSON笔记之二》封装JSONUtil
  • 原文地址:https://www.cnblogs.com/qhy1277/p/4686326.html
Copyright © 2011-2022 走看看