zoukankan      html  css  js  c++  java
  • [转] 为GridView删除添加确认对话框

    ① -----Template way-----
    <asp:TemplateField ShowHeader="False">
    <ItemTemplate>
    <asp:LinkButton runat="server" CausesValidation="False" CommandName="Delete"
    Text
    ="删除" OnClientClick='return confirm("Are you sure you want to delete this record?");'></asp:LinkButton>
    </ItemTemplate>
    </asp:TemplateField>

    ② -----RowDeleting method-----
    protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        Response.Write(
    "<script>window.confirm('确定删除吗?');</script>");
    }

    ③ -----RowDataBound method-----
    protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        
    if (e.Row.RowType == DataControlRowType.DataRow)
        
    {
            ((LinkButton)e.Row.Cells[
    4].Controls[0]).Attributes.Add("onclick""return confirm('确实要删除该记录吗?')");
        }

    }
  • 相关阅读:
    iOS
    iOS
    iOS
    iOS
    iOS
    使用jquery获取radio的值
    CSS margin属性与用法教程
    CSS框架960Grid从入门到精通一步登天
    从程序员到项目经理
    华为离职副总裁徐家骏:年薪千万的工作感悟
  • 原文地址:https://www.cnblogs.com/temptation/p/1123108.html
Copyright © 2011-2022 走看看