原文发布时间为: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的动态绑定的更多相关文章

  1. DropDownList怎样动态绑定数据库中的某一条数据

    用Ajax动态绑定数据库的数据:点击后台查看代码,编写代码如下 if (!IsPostBack) { using (SnailTechDataContext con = new SnailTechDa ...

  2. (转).net控件dropdownlist动态绑定数据

    DropDownList控件的使用(数据绑定)(.net学习笔记二)(2006-10-12 07:28:49) 转载   分类:.net学习笔记 一.在页面初始化时候将集合绑定到DropDownLis ...

  3. .net控件dropdownlist动态绑定数据 ----转

    DropDownList控件的使用(数据绑定)(.net学习笔记二) 一.在页面初始化时候将集合绑定到DropDownListpublic void Page_Load(Object src.Even ...

  4. 动态绑定DropDownList

    1.首先前台创建一个dropdownlist控件,并为这个控件起名id ,并且不要忘记runat=server这个属性,否则后台不能获取到该控件. 2.后台自定义方法绑定控件(本方法以三层架构的写法为 ...

  5. GridView中给DropDownList动态绑定数据,及选择列表值后自动更新数据库

    protected void sgvFile1_RowDataBound(object sender, GridViewRowEventArgs e) { DropDownList ddlAM = ( ...

  6. DropDownList的用法

    DropDownList是一个下拉列表菜单,平时我们也会经常用到,下面就来看看如何绑定值 1>     静态添加,就是说在值都很明确的情况下 ListItem list1 = new ListI ...

  7. DropdownList绑定的两种方法

    动态绑定方法一:动态绑定数据库中的字段. SqlConnection conn = UtilitySqlClass.OperateDataBase.ReturnConn();string strSQL ...

  8. C# DropDownList绑定添加新数据的几种方法

    第一种:在前台手动绑定(适用于固定不变的数据项) <asp:DropDownList ID="DropDownList1" runat="server"& ...

  9. 关于Dropdownlist使用的心得体会

    2013-07-23关于Dropdownlist使用的心得体会: Dropdownlist使用最多的几个属性: 一.Dropdownlist.Items,负责包含所有选项的容器 DropDownLis ...

随机推荐

  1. 有关SQL的一道面试题

    这是一个学生分数表 StudentName            StudySubject           SubjectScore Peter                           ...

  2. Android读书笔记三

    通过一章的学习体会到Git的重要性,因为想要获取开源的源代码,必须要使用Git,而且Linux内核完全是由Git管理的.Git是对源代码进行管理,在使用之前需要先安装,命令是 (1)apt-get i ...

  3. php 正则表达式中的 .*? 表示什么意思

    我们知道我 .* 是任意字符,有的时候比较困惑在加个?什么意思. ?是非贪婪模式.*会匹配后面的一切字符,就是到结束的意思加?后就是不贪婪模式,这时要看?后边的字符是什么了,如.*?"的意思 ...

  4. Struts2和SpringMVC简单配置以及区别总结

    Struts2: struts 2 是一个基于MVC(mode-view-con)设计模式的Web应用框架,是由Struts1和WebWork两个经典框架发展而来的. 工作流程: 1客户端浏览器发出H ...

  5. Python基础——字符串操作

    运算符 加(+)   str2="hello"+"python" print(str2) 乘(*)   str1="hello python" ...

  6. python网络-Socket之TCP编程(26)

    一.TCP简介 1.TCP介绍 TCP协议,传输控制协议(英语:Transmission Control Protocol,缩写为 TCP)是一种面向连接的.可靠的.基于字节流的传输层通信协议. TC ...

  7. Applied Nonparametric Statistics-lec1

    参考网址: https://onlinecourses.science.psu.edu/stat464/node/2 Binomial Distribution Normal Distribution ...

  8. Cheese Aizu - 0558 (搜索题)

    Time limit8000 ms Memory limit131072 kB チーズ () 問題 今年も JOI 町のチーズ工場がチーズの生産を始め,ねずみが巣から顔を出した.JOI 町は東西南北に ...

  9. Nordic Collegiate Programming Contest 2015​ E. Entertainment Box

    Ada, Bertrand and Charles often argue over which TV shows to watch, and to avoid some of their fight ...

  10. $ cat /usr/share/doc/wireshark-common/README.Debian

    $ cat /usr/share/doc/wireshark-common/README.Debian I. Capturing packets with Wireshark/Tshark There ...