一、@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"> < ...
随机推荐
- springcloud整合分布式事务LCN
一.创建eureka注册中心 a.pom文件 <properties> <java.version>1.8</java.version> <spring-cl ...
- spring 整合rabbitMQ
<!-- 配置邮件消息队列监听 --> <bean id="maillistener" class="cn.xdf.wlyy.listener.Mail ...
- 什么是网站TDK?
什么是网站TDK?可能很多新手站长与SEOer不知道.其实TDK就是网站的标题(title).描述(description)和关键词(keyword),TDK是网站很重要的元素,他是蜘蛛爬取你的网站之 ...
- 循环移动List元素
List 循环移动元素 使用 Collections 类的 rotate() 来循环移动元素,方法第二个参数指定了移动的起始位置: public class RotateList { public s ...
- centos6 / centos7 安装apache
=================centos6.1 安装apache===================== 安装: yum -y install httpd 启动 /etc/init.d/htt ...
- Session过期,如何跳出iframe框架页的问题
跳出框架页,实际上是更改父页面地址.那么更改父页面地址很简单即: window.parent.location='/Login/loginindex'; 这里说session过期,那么浏览器端的任何请 ...
- Java Web学习总结(6)Cookie/Session
一.会话的概念 会话可简单理解为:用户开一个浏览器,点击多个超链接,访问服务器多个web资源,然后关闭浏览器,整个过程称之为一个会话. 二.会话过程中要解决的一些问题 每个用户在使用浏览器与服务器进行 ...
- sql查看数据库环境及一些参数
sql查看数据库环境及一些参数 select parent_obj from sysobjects where name='FK_Student_banjiID' --根据外键名得到外表id sele ...
- jerry
jerry 题目描述 众所周知,Jerry 鼠是一只非常聪明的老鼠. Jerry 聪明到它可以计算64 位有符号整形数字的加减法. 现在,Jerry 写下了一个只由非负整数和加减号组成的算式.它想给这 ...
- 高并发大流量专题---3、前端优化(减少HTTP请求次数)
高并发大流量专题---3.前端优化(减少HTTP请求次数) 一.总结 一句话总结: 图片地图:使用<map><area></area></map>标签. ...