龍騎少校

玩的就是技术。ko!!!
  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

DropDownList--下拉菜单

Posted on 2008-09-19 15:39  龍騎少校  阅读(174)  评论(0编辑  收藏  举报

1、ArrayList数据列表(使用数据列表必须引入using System.Collections命名空间)

2、多态添加下拉列表

 


protected void Button1_Click(object sender, EventArgs e)
{
DropDownList4.Items.Add(TextBox1.Text.ToString());
}

 

3、分别添加Text,Value值,与插入项

 


DropDownList4.Items.Add(new ListItem("111", "111"));
DropDownList4.Items.Add(
new ListItem("122", "122"));
DropDownList4.Items.Insert(
1, new ListItem("222", "222"));//插入到第2个位置