DropDownList1
循环绑定数据到DropDownList1
foreach (SPList ls in web.Lists)
{
LIColl.Add(ls.Title);//将数据保存list中
}
dwlist.DataSource = LIColl;//绑定
dwlist.DataBind();//绑定
默认值
DataBound事件:
protected void DropDownList1_DataBound(object sender, EventArgs e)
{
DropDownList1.Items.Insert(0, new ListItem("---请选择---", "0"));
DropDownList1.SelectedIndex = 0;
}
获取选的值
写到SelectedIndexChanged事件里面
要先把dropdownlist控件的autopostback属性改为true
private void DropDownList1_SelectedIndexChanged(object sender, System.EventArgs e)
{
this.Label3.Text=this.DropDownList2.SelectedItem.ToString();//text this.Label4.Text=this.DropDownList2.SelectedValue.ToString();//value
}
如果用按钮就可以直接写
private void Button1_Click(object sender, System.EventArgs e)
{
this.Label1.Text=this.DropDownList1.SelectedItem.ToString();
this.Label2.Text=this.DropDownList1.SelectedValue.ToString();
}
DropDownList1的更多相关文章
- DropDownList1.Items.Insert 与 DropDownList1.Items.Add 的区别
DropDownList1.Items.Insert 与 DropDownList1.Items.Add 的区别 dropwdownist1.items.insert 是可以添加在制定索引处的 而dr ...
- ADO.NET对象的详解
1. Connection 类 和数据库交互,必须连接它.连接帮助指明数据库服务器.数据库名字.用户名.密码,和连接数据库所需要的其它参数.Connection对象会被Command对象使用,这样就能 ...
- fluent批量处理——模型参数的设置
对于常见的工程应用来说,计算的工况很多,尤其优化工作,少则几百,多则上千,面对如此之多的case文件要写,假如按照一个一个的读写的话,相信你一定会为这么机械的工作烦躁,甚至影响今后好几天的心情,那么有 ...
- Webform(五)——内置对象(Response、Request)和Repeater中的数据增删改
一.内置对象 (一)Response对象 1.简介:response 对象在ASP中负责将信息传递给用户.Response对象用于动态响应客户端请求,并将动态生成的响应结果返回到客户端浏览器中,使用R ...
- FineUI(开源版)v6.0中FState服务器端验证的实现原理
前言 1. FineUI(开源版)是完整开源,最早发起于 2008-04,下载全部源代码:http://fineui.codeplex.com/ 2. 你可以通过捐赠作者来支持FineUI(开源版)的 ...
- C#-WebForm-复合控件
学习顺序:1.如何绑定数据 2.如何设置绑定项 3.如何取出数据 1.RadioButton - 单选按钮 RadioButtonList - 单选按钮组 控件中的ID生成了相同名字的 ID.Name ...
- ASP.NET上实现
ASP.NET上实现 fengzhuang.cs: using System;using System.Collections.Generic;using System.Linq;using Syst ...
- Application对象、ViewState对象、分页展示--2017年1月4日
Application对象 存储 Application 变量 Application["application名称"] = "application的值"; ...
- weibform中Application、ViewState对象和分页
Application: 全局公共变量组 存放位置:服务器 特点:所有访问用户都是访问同一个变量,但只要服务器不停机,变量一直存在于服务器的内存中,不要使用循环大量的创建Application对象,可 ...
随机推荐
- struts2动态方法
动态方法调用 在Struts2中动态方法调用有三种方式,动态方法调用就是为了解决一个Action对应多个请求的处理,以免Action太多 第一种方式:指定method属性 这种方式我们前面已经用到过, ...
- grid-css
.fil-container { width: 100%; max-width: 75rem; margin-right: auto; margin-left: auto; padding-left: ...
- Unix/Linux 命令技巧
锁定一个文件夹 为了我的数据隐私,我想要锁定我文件服务器下的/downloads文件夹.因此我运行了: chmod 0000 /downloads root用户仍旧可以访问,而ls和cd命令则不工作. ...
- RequestMethod.DELETE相关,如何用jquery实现RequestMethod.DELETE请求
Spring MVC添加支持Http的delete.put请求!(HiddenHttpMethodFilter) Spring3.0之后->Spring MVC过滤器-HiddenHttpMet ...
- 使用JMeter创建数据库(Mysql)测试
我的环境:MySQL:mysql-essential-5.1.51-win32 jdbc驱动:我已经上传到csdn上一个:http://download.csdn.net/source/3451945 ...
- ubuntu使用ssh登入不执行.bashrc解决方法
解决方法,可以直接输入 bash即可. 理解 bashrc 和 profile linux bashrc profile SEP 30TH, 2011 BY SUNTEYA 在一般的 linux 或者 ...
- javascript设计模式-装饰模式
装饰模式:在不改变原类(对象)和继承的情况下动态扩展对象功能,通过包装一个对象来实现一个新的具有原对象相同接口的新的对象.在设计原则中,有一条,多用组合,少用继承,装饰模式正是这一原则的体现. UML ...
- Logistic Regression and Gradient Descent
Logistic Regression and Gradient Descent Logistic regression is an excellent tool to know for classi ...
- pthread多线程编程的学习小结
pthread多线程编程的学习小结 pthread 同步3种方法: 1 mutex 2 条件变量 3 读写锁:支持多个线程同时读,或者一个线程写 程序员必上的开发者服务平台 —— DevSt ...
- 面试题52:缺少i的乘积数组
vector<int> multiply(const vector<int>& A) { int len = A.size(); vector<); result ...