1:绑定下拉菜单
ArrayList ids = new ArrayList();
DataAccess.adminAccess login = new DataAccess.adminAccess(System.Configuration.ConfigurationManager.AppSettings["connstring"].ToString());
Data.adminData dsUserInfo = login.Query();
this.DropDownList1.Items.Clear();
for (int i = 0; i < dsUserInfo.Tables[0].Rows.Count; i++)
{
string id_str = dsUserInfo.Tables[0].Rows[i]["aid"].ToString();
ids.Add(id_str);
}
IEnumerator ienum = ids.GetEnumerator();
while (ienum.MoveNext())
{
this.DropDownList1.Items.Add(new ListItem(ienum.Current.ToString(),"1"));
}
=============================================================================================
2:循环删除
ArrayList ids = new ArrayList();
for (int i = 0; i < this.GridView1.Rows.Count; i++)
{
CheckBox chk = (CheckBox)GridView1.Rows[i].FindControl("CheckAll");
if (chk.Checked)
{
string id_str = this.GridView1.DataKeys[i].Value.ToString();
Guid id = new Guid(id_str);
ids.Add(id);
}
}
IEnumerator ienum = ids.GetEnumerator();
while (ienum.MoveNext())
{
DeleteID((Guid)ienum.Current);//执行删除函数
}
ShowAll();