一、@Html.DropDownList
一、Html.DropDownList 通过linq 将datatable转换下拉列表
//查询城市
string CityId = WebCommon.Public.GetAdminCityId();
var CityList = WebBLL.Tbl_ClassManager.GetDataTableByPage(, , "parentid=3", "ordernum asc");
List<SelectListItem> item1 = new List<SelectListItem>();
var lstID = (from d in CityList.AsEnumerable() select new SelectListItem(){ Text = d["ClassName"].ToString(),Value = d["ID"].ToString() ,Selected = (d["ID"].ToString()== CityId ?true :false) });
item1.AddRange(lstID);
ViewBag.SubCity = item1;
@{
if (Convert.ToInt32(HttpContext.Current.Request.Cookies["CityId"].Value) != )
{
@Html.DropDownList("SubCity", null, new { @class = "input-xlarge form-control", @disabled = "disabled" });
}
else
{
@Html.DropDownList("SubCity", null, new { @class = "input-xlarge form-control" })
}
}
一、@Html.DropDownList的更多相关文章
- Asp.Net 将枚举类型(enum)绑定到ListControl(DropDownList)控件
在开发过程中一些状态的表示使用到枚举类型,那么如何将枚举类型直接绑定到ListControl(DropDownList)是本次的主题,废话不多说了,直接代码: 首先看工具类代码: /// <su ...
- DropDownList 下拉框选择改变,促发事件和防全局刷新(记录)
代码: <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:Script ...
- DropDownList实现可输入可选择
1.js版本 <div style="z-index: 0; visibility: visible; clip: rect(0px 105px 80px 85px); positio ...
- js给DropdownList赋值
", "model": "APOLLO M/B1"}]; ; i < row.length; i++) { var addOption = do ...
- ASP.NET MVC 让@Html.DropDownList显示默认值
在使用@Html.DropDownList的过程中,发现它的用法很局限,比如在加载的时候显示设定的默认项或者调整它的显示样式,在网上查了一些资料,终于把这个问题解决了. 一.View代码 @using ...
- GridView中实现DropDownList联动
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.We ...
- "不能在 DropDownList 中选择多个项。"其解决办法及补充
探讨C#.NET下DropDownList的一个有趣的bug及其解决办法 摘要: 本文就C#.Net 环境下Web开发中经常使用的DropDownList控件的SelectedIndex属性进行了详细 ...
- Asp.net mvc页面传值-- dropdownlist
后台传值 List<ConfigParamInfo> paramList = configParamBLL.GetModelList(" and parentID=1" ...
- 怎么取得dropdownlist选中的ID值
把数据库绑定在dropdownlist中,然后把选中的dropdownlist的项的ID值保存在另外的一个数据库中.怎么取得dropdownlist选中的ID值呢?? this.DropDownLis ...
- MVC5中后台提供Json,前台处理Json,绑定给Dropdownlist的例子
MVC5中后台提供Json,前台处理Json,绑定给Dropdownlist的例子: 前端: 我们以前在前端定义了两个控件: <div class="row"> < ...
随机推荐
- Retrofit与RXJava整合(转)
Retrofit 除了提供了传统的 Callback 形式的 API,还有 RxJava 版本的 Observable 形式 API.下面我用对比的方式来介绍 Retrofit 的 RxJava 版 ...
- ansible笔记(三)--模块讲解
ansible 常用命令 ansible-doc ansible-playbook ansible-vault ansible-console ansible-galaxy ansible-pull ...
- .net core 操作oracle
依赖项——右键——管理NuGet程序包——浏览——输入以下内容 oracle.ManagedDataAccess.core(记得勾选包括预发行版) 在页面中加入操作数据库的方法 public IAct ...
- Java Web 之HttpServletRequest对象初识
通过request对象获得请求行 获得客户端请求方式:String getMethod(); 获得请求的资源: String getRequestURL(); String getQueryStrin ...
- maven仓库mirrors
<mirrors> <mirror> <id>alimaven</id> <name>aliyun maven</name> & ...
- win7系统下IIS7.5配置MVC5环境注意事项与CentOS的MVC5设置
注意事项: 1.IIS程序应用池更换为4.0net集成 2.网站目录加入IIS帐号的权限(基本设置里是administrators组帐号)注:服务器拒绝时是这里的问题 3.在“ISAPI和CGI限制” ...
- 【leetcode】126. Word Ladder II
题目如下: 解题思路:DFS或者BFS都行.本题的关键在于减少重复计算.我采用了两种方法:一是用字典dic_ladderlist记录每一个单词可以ladder的单词列表:另外是用dp数组记录从star ...
- spring微服务(顺序由简入难易于理解)
一.为微服务应用增加健康监控 1.在 build.gradle 文件 dependencies 属性中增加 compile('org.springframework.boot:spring-boot- ...
- 用K-近邻算法分类和回归
import numpy as npfrom matplotlib import pyplot as plt X_train = np.array([ [158, 64], [170, 66], [1 ...
- [TensorFlow 2] [Keras] fit()、fit_generator() 和 train_on_batch() 分析与应用
前言 是的,除了水报错文,我也来写点其他的.本文主要介绍Keras中以下三个函数的用法: fit()fit_generator()train_on_batch()当然,与上述三个函数相似的evalua ...