62,046
社区成员
发帖
与我相关
我的任务
分享
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
{
if(e.CommandName=="SEL")
{
string str=e.CommandArgument.ToString();
//继续下一步
}
}
foreach (GridViewRow i in this.GridView1.Rows)
{
CheckBox cb = (CheckBox)(i.Cells[0].FindControl("CheckBox1"));
if (cb.Checked)
{
product p = new product();
p.ProductId= int.Parse(this.GridView1.DataKeys[i.RowIndex].Value.ToString());//这样用的话必须在设计页面指定GridView的Datakeys性 }
}
foreach (GridViewRow i in this.GridView1.Rows)
{
CheckBox cb = (CheckBox)(i.Cells[0].FindControl("CheckBox1"));
if (cb.Checked)
{
product p = new product();
p.ProductId= int.Parse(this.GridView1.DataKeys[i.RowIndex].Value.ToString());
BLL.ListBLL lst = (BLL.ListBLL)Session["list"];//获取要删除的行唯一标示
if (lst.delpro(p))//执行删除的方法
{
Session["list"] = lst;
ShowAll();
}
}
}