62,047
社区成员
发帖
与我相关
我的任务
分享
==在Gridview 添加一列
<asp:TemplateColumn HeaderText="操作">
<itemstyle horizontalalign="Center" />
<itemtemplate>
<cc1:LinkButton id="lbActivate" runat="server" CommandName="delete" onclientclick="return window.confirm('如果删除该人员将无法恢复,是否要删除该人员?');"></cc1:LinkButton>
</itemtemplate>
<headerstyle horizontalalign="Center" width="15%" />
</asp:TemplateColumn>
//然后 通过,Gridview 的ItemCommand事件
protected void DataGridUserList_ItemCommand(object source, DataGridCommandEventArgs e)
{
string id = this.DataGridUserList.DataKeys[e.Item.ItemIndex].ToString();
if (e.CommandName == "delete")
{
if ()//写自己调用 底层的方法,或 sql 语句
{
Popwin.ShowMessage("删除成功!", this.Page);
}
else
{
Popwin.ShowMessage("删除失败!", this.Page);
}
}
//删除完后在把数据绑定一便
//this.DataGridUserListDataBind();
}
}
==在Gridview 添加一列
<asp:TemplateColumn HeaderText="操作">
<itemstyle horizontalalign="Center" />
<itemtemplate>
<cc1:LinkButton id="lbActivate" runat="server" CommandName="delete" onclientclick="return window.confirm('如果删除该人员将无法恢复,是否要删除该人员?');"></cc1:LinkButton>
</itemtemplate>
<headerstyle horizontalalign="Center" width="15%" />
</asp:TemplateColumn>
然后 通过,Gridview 的ItemCommand事件
protected void DataGridUserList_ItemCommand(object source, DataGridCommandEventArgs e)
{
string id = this.DataGridUserList.DataKeys[e.Item.ItemIndex].ToString();
if (e.CommandName == "delete")
{
if ()//写自己调用 底层的方法,或 sql 语句
{
Popwin.ShowMessage("删除成功!", this.Page);
}
else
{
Popwin.ShowMessage("删除失败!", this.Page);
}
}
//删除完后在把数据绑定一便
//this.DataGridUserListDataBind();
}
}