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('确实要删除该记录吗?')");
        }

    }
  • 相关阅读:
    KBMMW 4.80.00 发布
    RCF库ClientStub.setAutoReconnect
    编译 boost
    2017学习计划
    _beginthreadex注意事项
    push_back模式工作
    总结2016
    <转>好婚姻是彼此放心
    ProcessExplore 最新版
    网站seo新手快速提升自己的技巧
  • 原文地址:https://www.cnblogs.com/temptation/p/1123108.html
Copyright © 2011-2022 走看看