net3:DropDownList的动态绑定
原文发布时间为:2008-07-29 —— 来源于本人的百度文章 [由搬家工具导入]
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class Default3 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
ArrayList name = new ArrayList();
name.Add("lily");
name.Add("lucy");
name.Add("lilei");
DropDownList1.DataSource = name;
DropDownList1.DataBind();
}
}
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
switch (DropDownList1.SelectedValue)
{
case "lily":
Label1.Text = "lily a";
break;
case "lucy":
Label1.Text = "lucy b";
break;
case "lilei":
Label1.Text = "lilei c";
break;
}
}
protected void Button1_Click(object sender, EventArgs e)
{
string add = TextBox1.Text;
DropDownList4.Items.Add(add);
}
}
net3:DropDownList的动态绑定的更多相关文章
- DropDownList怎样动态绑定数据库中的某一条数据
用Ajax动态绑定数据库的数据:点击后台查看代码,编写代码如下 if (!IsPostBack) { using (SnailTechDataContext con = new SnailTechDa ...
- (转).net控件dropdownlist动态绑定数据
DropDownList控件的使用(数据绑定)(.net学习笔记二)(2006-10-12 07:28:49) 转载 分类:.net学习笔记 一.在页面初始化时候将集合绑定到DropDownLis ...
- .net控件dropdownlist动态绑定数据 ----转
DropDownList控件的使用(数据绑定)(.net学习笔记二) 一.在页面初始化时候将集合绑定到DropDownListpublic void Page_Load(Object src.Even ...
- 动态绑定DropDownList
1.首先前台创建一个dropdownlist控件,并为这个控件起名id ,并且不要忘记runat=server这个属性,否则后台不能获取到该控件. 2.后台自定义方法绑定控件(本方法以三层架构的写法为 ...
- GridView中给DropDownList动态绑定数据,及选择列表值后自动更新数据库
protected void sgvFile1_RowDataBound(object sender, GridViewRowEventArgs e) { DropDownList ddlAM = ( ...
- DropDownList的用法
DropDownList是一个下拉列表菜单,平时我们也会经常用到,下面就来看看如何绑定值 1> 静态添加,就是说在值都很明确的情况下 ListItem list1 = new ListI ...
- DropdownList绑定的两种方法
动态绑定方法一:动态绑定数据库中的字段. SqlConnection conn = UtilitySqlClass.OperateDataBase.ReturnConn();string strSQL ...
- C# DropDownList绑定添加新数据的几种方法
第一种:在前台手动绑定(适用于固定不变的数据项) <asp:DropDownList ID="DropDownList1" runat="server"& ...
- 关于Dropdownlist使用的心得体会
2013-07-23关于Dropdownlist使用的心得体会: Dropdownlist使用最多的几个属性: 一.Dropdownlist.Items,负责包含所有选项的容器 DropDownLis ...
随机推荐
- [].indexOf.call()学习
今天看到闭包一道题,就是一个li列表,点击列表控制台输出对应的索引.这里考察了var的作用域问题和闭包对外部变量的引用问题,有几种解决方法. html: <ul> <li>te ...
- 【转】EM算法原理
EM是我一直想深入学习的算法之一,第一次听说是在NLP课中的HMM那一节,为了解决HMM的参数估计问题,使用了EM算法.在之后的MT中的词对齐中也用到了.在Mitchell的书中也提到EM可以用于贝叶 ...
- [Codeforces Round #250]小朋友和二叉树
题目描述: bzoj luogu 题解: 生成函数ntt. 显然这种二叉树应该暴力薅掉树根然后分裂成两棵子树. 所以$f(x)= \sum_{i \in c} \sum _{j=0}^{x-c} f( ...
- Linux 用户管理(一)
一.基础知识介绍 用户 用户组的概念 每个文件和进程,都需要对应一个用户和用户组 linux 系统通过UID和 GID识别用户和组 用户名相当于人名(给人看) UID和GID相当于身份证(系统用的) ...
- [译]The Python Tutorial#4. More Control Flow Tools
[译]The Python Tutorial#More Control Flow Tools 除了刚才介绍的while语句之外,Python也从其他语言借鉴了其他流程控制语句,并做了相应改变. 4.1 ...
- HMAC(Hash-based Message Authentication Code)实现原理
1.HMAC 概念 HMAC(Hash-based Message Authentication Code)基于 hash 的消息验证码,是 安全通信中必要的组成部件. 主要是 防止消息被篡改,和对称 ...
- NTC温度采集之数据拟合——freemat软件实现
在stm32温度采样的过程中,使用到了NTC传感器,上拉接6.2K的电阻,信号给AD采样端口,通过NTC的电阻阻值表中,计算得到下面两端数据,在freemat中实现数据拟合,用于程序中温度和电压信号的 ...
- Ice cream samples Gym - 101670G 滑动扫描
题目:题目链接 思路:比赛中读错了题,题目要求选一个连续区间,却读成了随便选取几个柜台,英语要好好学啊,读懂题就很简单了,扫一遍就出结果了 AC代码: #include <iostream> ...
- POJ:3160-Father Christmas flymouse
Father Christmas flymouse Time Limit: 1000MS Memory Limit: 131072K Description After retirement as c ...
- The 2018 ACM-ICPC Chinese Collegiate Programming Contest Fight Against Monsters
#include <iostream> #include <cstdio> #include <cstring> #include <string> # ...