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 ...
随机推荐
- 判断用户ip是否在指定的一个ip段内
/** * 判断ip是否在一个ip段内 * * @param args */ public static boolean ipExistsInRange(String ip, String ipSec ...
- cocos2d-x中解决暂停并保存画面和开始的功能
1.调用所有对象的pauseSchedulerAndActions().太麻烦,不太现实,而且有很多对象不易获取. 2.CCDirector::sharedirector()->pause(). ...
- 66. Plus One@python
Given a non-empty array of digits representing a non-negative integer, plus one to the integer. The ...
- Your Ride Is Here
纯粹的水题= = /* ID:yk652321 LANG:C++ TASK:ride */ #include<iostream> #include<cstring> #incl ...
- centOS下lnamp安装
首先安装apache,mysql ,最后安装php 1>apache安装 安装:yum install -y httpd 运行:/bin/systemctl start httpd.servic ...
- ERROR 1045 (28000): Access denied for user 'xxx'@'localhost' (using password: YES) MYSQL 新建用户 无法登录 问题解决方法
使用mysql ,出现新建账户无法登录问题 查看 user列表中,有部分账户没有设置密码,将全部重新设置一遍密码,然后还是无法登录. 使用命令 update user set password=pas ...
- php使用curl访问https返回无结果的问题
最近在做一个微信自动登录,发起验证以后回调页面获取openid时 curl函数返回空. $appid = "appid appid "; $secret = "secre ...
- DeepFaceLab小白入门(6):脸部替换以及合成视频!
前面的都是准备工作,这个环节才是真的换脸.换脸主要分两部分,1,图片换脸,2,把图片合成视频. 7) convert H64 debug.bat 这个环节是和训练环节相对于的,比如我们之前选的是H64 ...
- 李涛ps高手之路
下载地址:http://www.ly89.cn/detailR/21.html
- JAVA基础篇—异常
五种常见异常 1.NullPointerException 空指针 2.ClassNotFoundException 指定类不存在 3.ArithmeticException运算异常 4.ArrayI ...