asp:DropDownList 使用
<asp:DropDownList ID="DropDownList1" runat="server" onchange="return My_DropDownList1()" />
一、DropDownList后台数据绑定
1.DropDownList1.DataSource=DataSet.tables 绑定数据源。
2.DropDownList1.DataValueField="ID" 绑定主键。
3.DropDownList1.DataTextField=“Text” 绑定显示的文本。
4.DropDownList1.DataBind() 绑定数据。
二、DropDownList前台JavaScript获取选中项索引和获取选中项文本
<script type="text/javascript">
function My_DropDownList1(){
var DD_TXT=$('#DropDownList1 option:selected').text(); 获取选中项文本
var DD_ID=$('#DropDownList1 option:selected').val(); 获取选中项文本对应的索引,也就是我们绑定的主键ID
}
</script>
三、DropDownList后台通过事件获取文本和对应的索引值
DropDownList1.SelectedItem.Text 获取文本
DropDownList1.SelectedItem.Value 获取索引值
asp:DropDownList 使用的更多相关文章
- asp:DropDownList与asp:DataList的联合使用
情况:当在asp:DropDownLis点击选取其中的一个值来响应datalist的值. <form id="form1" runat="server"& ...
- ASP DropDownList部分选项无法触发回传问题
今天偶然碰到这个问题,一个通过后台绑定的DropDownList控件出现部分选项触发事件,部分选项不触发事件的问题: 原因是多个OPTION的Value值一致,导致ASP事件注册失败,只要在绑定过程中 ...
- js 获取asp:dropdownlist选中的值
var eSection = document.getElementById("<%=tx_ddlType.ClientID%>"); var eSectionValu ...
- jquery 设置asp:dropdownlist 选中项
$("#ddlPro").find('option').each(function () { this.selected = (this.text == dlprom); });
- Asp.Net 将枚举类型(enum)绑定到ListControl(DropDownList)控件
在开发过程中一些状态的表示使用到枚举类型,那么如何将枚举类型直接绑定到ListControl(DropDownList)是本次的主题,废话不多说了,直接代码: 首先看工具类代码: /// <su ...
- ASP.NET Repeater 绑定 DropDownList Calendar 选择日期
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.We ...
- ASP.NET中使用DropDownList实现无刷新二级联动详细过程
Demo.sql create table Car( [id] int identity, ) not null, ) not null ) go insert into Car ([brand],[ ...
- 《ASP.NET1200例》嵌套在DataLisT控件中的其他服务器控件---DropDownList控件的数据绑定
aspx <script type="text/javascript"> function CheckAll(Obj) { var AllObj = document. ...
- ASP.NET笔记之 ListView 与 DropDownList的使用(解决杨中科视频中的问题)
1.Repeater用来显示数据.ListView用来操作数据 InsertItemTemplate和updateItemTemplate**Eval(显示数据)和Bind(双向绑定:不仅是需要展现, ...
随机推荐
- PHP:自己写的mysql操作类
a{ font-weight: bold; display: block; text-align: center; color: #5887bf; font-size: 22px; } .conten ...
- 获取object的值
class Program { static void Main(string[] args) { var data = Unite(); var name = data.GetType().GetP ...
- Iview Modal 点击确定就关闭,我想禁止关闭该怎么办呢?
网上各种loading,不推荐.用下面的方法直接就解决了 <div slot="footer"> <Button type="text" si ...
- 交叉熵理解:softmax_cross_entropy,binary_cross_entropy,sigmoid_cross_entropy简介
cross entropy 交叉熵的概念网上一大堆了,具体问度娘,这里主要介绍深度学习中,使用交叉熵作为类别分类. 1.二元交叉熵 binary_cross_entropy 我们通常见的交叉熵是二元交 ...
- tensorflow models api:ValueError: Tensor conversion requested dtype string for Tensor with dtype float32: 'Tensor("arg0:0", shape=(), dtype=float32, device=/device:CPU:0)'
tensorflow models api:ValueError: Tensor conversion requested dtype string for Tensor with dtype flo ...
- shell 常用案例
此博文有自己写的其它朋友分享的,其中对其它朋友写的有问题的地方我简单做了一些修改,能保证运行. 1.写一个脚本通过ping命令测试192.168.0151到192.168.0.254之间的所有主机是否 ...
- “AS3.0高级动画编程”学习:第一章高级碰撞检测
AdvancED ActionScript 3.0 Animation 是Keith Peters大师继"Make Things Move"之后的又一力作,网上已经有中文翻译版本了 ...
- springboot指定端口的三种方式
第一配置文件中添加server.port=9090 第二在命令行中指定启动端口,比如传入参数一server. port=9000 java -jar bootsample. jar -- se ...
- 获取当前div中的文本(只获取当前div的, 子元素不要, 基于layui)
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title> ...
- python跨平台注释
使python程序运行在window以外的平台上 !# user/bin/python