在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 + "');"); 就会执行这个事件
哪位能指点迷津 困扰我一上午了 这个问题!
<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 + "');"); 就会执行这个事件
哪位能指点迷津 困扰我一上午了 这个问题!
...全文
相关推荐
GridView实现删除时弹出确认对话框
GridView实现删除时弹出确认对话框
asp.net GridView 删除时弹出确认对话框(包括内容提示)
GridView 删除时弹出确认对话框(包括内容提示)
弹出 删除 确认 对话框
为GRIDVIEW“删除”列添加确认对话框 确认对话框
gridview删除时弹出对话框
源码讲述如何实现gridview删除时弹出对话框的效果。
ASP.NET中为GridView添加删除提示框的方法
本文实例讲述了ASP.NET中为GridView添加删除提示框的方法。分享给大家供大家参考。具体分析如下: 在GridView中我们可以直接添加一个CommandField删除列来删除某行信息。但为了避免误操作引起的误删除,在删除操作者让操作者再确认下,完后再进行删除。 首先我们给我们的GridView 添加一个模板列,如下: 以下是引用片段: <ASP HeaderText=Delete ShowHeader=False> <ItemStyle ForeColor=Red> <ItemTemplate> <asp:LinkButton ID=


