在GridView的某一列上添加 确认删除对话框 却不执行确认操作是什么原因呢??

LotusUnix LotusUnix 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
这个是前台代码
<asp:ButtonField CommandName="Test" Text="送审" HeaderText="送审" ButtonType="Button" >
<ItemStyle BorderColor="#4AA5A0" Font-Bold="True" />
<HeaderStyle BorderColor="#4AA5A0" />
<FooterStyle BorderColor="#4AA5A0" />
<ControlStyle Font-Bold="True" ForeColor="#4AA5A0" />
</asp:ButtonField>

在这里加的对话框
protected void GridView_Work_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)//如果是数据行的话
{
string title = e.Row.Cells[1].Text.ToString();
string shangbao="您确认要送审工作:"+title+"吗?";
Button btnsb = (Button)e.Row.Cells[4].Controls[0];
btnsb.Attributes.Add("onclick", "return confirm('" + shangbao + "');");
}
}
却不执行 这个事件
protected void GridView_Work_RowCommand(object sender, GridViewCommandEventArgs e)
{

if (e.CommandName == "Test")//表明是送审
{
}
}
但要是把这个去掉 btnsb.Attributes.Add("onclick", "return confirm('" + shangbao + "');"); 就会执行这个事件
哪位能指点迷津 困扰我一上午了 这个问题!
...全文

相关推荐

评论 6
收藏 已收藏
分享
返回顶部
LotusUnix
C# 111,128 成员 642,537 内容