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对象,可 ...
随机推荐
- C语言中memset(void *s, char ch,unsigned n)用的用法
将指针s所指的内存空间中前n为重置为字符c 程序例: #include <string.h> #include <stdio.h> #include <memory.h& ...
- oracle-7参数文件的管理
参数文件的管理:1.参数文件的作用:记录数据库的配置的 (1)pfile ---> 文本文件 (2)spfile --->服务器的参数文件(二进制的) 两个参数文件的区别: pfile ...
- 【Gym 100610A】Alien Communication Masterclass
题 Andrea is a famous science fiction writer, who runs masterclasses for her beloved readers. The mos ...
- Yii2分页
Yii中的分页功能主要由yii\web: Linkable接口.yii\widgets: LinkPager类和yii\data: Pagination类三个组成 yii\data: Paginati ...
- BZOJ-2190 仪仗队 数论+欧拉函数(线性筛)
今天zky学长讲数论,上午水,舒爽的不行..后来下午直接while(true){懵逼:}死循全程懵逼....(可怕)Thinking Bear. 2190: [SDOI2008]仪仗队 Time Li ...
- 利用Spring中的HtmlUtils.htmlEscape(input)过滤html
fatherModule.setModuelName(HtmlUtils.htmlEscape(fatherModule.getModuelName())); log.info(HtmlUtils.h ...
- 如何通俗地理解 Gradle
http://www.zhihu.com/question/30432152 一句话概括就是:依赖管理和任务执行. 像Ruby里面的bundler+rake,像iOS中的cocoapods,像node ...
- Linux上的free命令详解
解释一下Linux上free命令的输出. 下面是free的运行结果,一共有4行.为了方便说明,我加上了列号.这样可以把free的输出看成一个二维数组FO(Free Output).例如: FO[2][ ...
- TIME_WAIT过多
Linux系统下,TCP/IP连接断开后,会以TIME_WAIT状态保留一定的时间,然后才会释放端口.当并发请求过多的时候,就会产生大量的 TIME_WAIT状态的连接,无法及时断开的话,会占用大量的 ...
- How much training data do you need?
How much training data do you need? //@樵夫上校: 0. 经验上,10X规则(训练数据是模型参数量的10倍)适用与大多数模型,包括shallow networ ...