是这样的,我一般用如下两种方式弹出提示Page.ClientScript.RegisterStartupScript(this.GetType(), "提示信息", "<script>alert('" + "操作成功!" + "');</script>");
ScriptManager.RegisterStartupScript(this.gv_OrderInfo, this.gv_OrderInfo.GetType(), "唯一标识符12", "alert('" + "操作成功!" + "')", true);但问题是,弹出过一次以后,就在前台html源码中有了alert代码,html的最后三行代码如下<script>alert('删除失败!');</script></form>
</body>
</html>
这时候问题就来了,无论是我按F5刷新界面,或者按IE上的“后退”按钮或“前进”按钮转到该页时,都弹出这个消息框。
请教各位高手,如何在F5刷新 “前进”后“后退”转到该页时 禁止弹出这个框

解决方案 »

  1.   

    我点击到的是Gridiview中的某一个操作列 这个行么?            <asp:ButtonField CommandName="Delete" Text="删除" >
                <ItemStyle Width="30px"></ItemStyle>
                <ControlStyle ForeColor="Blue" />
                </asp:ButtonField>
      

  2.   

    web页
    <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>.cs
    需要弹出提示的地方,比如是
      protected void Button1_Click(object sender, EventArgs e)
        {
               Label1.Text = "<script>alert('这是弹出提示!'); </script>";
        }    protected void Page_Load(object sender, EventArgs e)
        {
            Label1.Text = "";      }
      

  3.   

    问个问题 我之前执行了一次RowDeleting
    此时 F5刷新一次, 就自动又去执行RowDeleting事件了 请问应该如何在这种情况下禁止触发RowDeleting
    事件
      

  4.   

    我在Load中去设定一个bool值来判断如何?
            protected void Page_Load(object sender, EventArgs e)
            {
                if (!IsPostBack)
                {
                    if (SessionCommon.IsHaveSession())
                    {
                        NewUI();
                    }
                }
             //F5会触发这个,我在这里设置bool值如何? 
            }
      

  5.   


            protected void Page_Load(object sender, EventArgs e)
            {
                if (!IsPostBack)
                {
                    if (SessionCommon.IsHaveSession())
                    {
                        NewUI();
                    }
                }
          //F5会执行这个位置,我在这里设置bool值如何?          }
      

  6.   

    回复不能超过3次,换马甲说一下哈、、我改用ajax了  把 GridView放在了ajax,提示用的ScriptManager.RegisterStartupScript,这样前台貌似就不会生成alart了(至少我没看到),因为做的是内网OA 所以性能方面可以暂时先这样
      

  7.   

    对于你的问题,操作之后如果不想返回其它页面,
    可以用Response.Redirect("test.aspx")重新定向到本页面.
      

  8.   

    嗯是个思路, 我暂时用ajax把gridview和分页控件全放里面了,我知道这种方式会影响性能,暂时先这么搞,随着自己技术水平的提高再逐步完善,大牛们还有建议么?结贴?
      

  9.   

    放在ajax控件中之后舒服多喽F5之后再也不会再触发RowDeleting了刚刚接触asp.net,为什么会这样?具体的原理谁能说说?