DropDownList.Items的常用方法

DropDownList.Items的常用方法
在最后一项添加:
DropDownList.Items.Add("text")
or
DropDownList.Items.Add(new ListItem("text","value"))

在指定的位置添加一项:
DropDownList.Items.Insert(index, new ListItem("text","value"));

移除指定的项:
DropDownList.Items.Remove("text");
or
DropDownList.Items.RemoveAt(index)

移除所有的项:
DropDownList.Items.Clear()

项的总数:
DropDownList.Items.Count
posted @ 2009-08-02 21:24  djune  阅读(700)  评论(0编辑  收藏  举报