在GridView的某一列上添加 确认删除对话框 却不执行确认操作是什么原因呢??
这个是前台代码
<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 + "');"); 就会执行这个事件
哪位能指点迷津 困扰我一上午了 这个问题!