protected void Page_Load(object sender, EventArgs e)
{
//向下拉列表框中添加列表项
if (!IsPostBack)
{
this.dropName.Items.Add(new ListItem("北京", "0"));
this.dropName.Items.Add(new ListItem("上海", "1"));
this.dropName.Items.Add(new ListItem("深圳", "2"));
this.dropName.Items.Add(new ListItem("唐山", "3"));
}
}
protected void btnDelete_Click(object sender, EventArgs e)
{
//删除选择的列表项
ListItem Item = dropName.SelectedItem;
dropName.Items.Remove(Item);
}
protected void btnDeleteAll_Click(object sender, EventArgs e)
{
//清除所有列表项
dropName.Items.Clear();
}
{
//向下拉列表框中添加列表项
if (!IsPostBack)
{
this.dropName.Items.Add(new ListItem("北京", "0"));
this.dropName.Items.Add(new ListItem("上海", "1"));
this.dropName.Items.Add(new ListItem("深圳", "2"));
this.dropName.Items.Add(new ListItem("唐山", "3"));
}
}
protected void btnDelete_Click(object sender, EventArgs e)
{
//删除选择的列表项
ListItem Item = dropName.SelectedItem;
dropName.Items.Remove(Item);
}
protected void btnDeleteAll_Click(object sender, EventArgs e)
{
//清除所有列表项
dropName.Items.Clear();
}