单击网格中的 LinkBut​​ton 时避免页面刷新

2023-12-29

我有一个GridView控件,并且在该控件内部我使用定义了一个链接按钮GridView.ItemTemplate.

我用它来点击打开一个新窗口。但是,当我单击链接按钮时,页面会在打开新窗口之前刷新。

单击链接按钮后如何阻止页面刷新?

当我将更新面板添加到第一个网格时,弹出窗口不显示

如果我从第一个网格中删除更新面板,网格将刷新并显示弹出窗口

我需要打开一个弹出窗口而不刷新我的网格

请为我找到解决方案,因为我过去 2 天一直在研究这个问题

HTML

<%@ Page Language="c#" AutoEventWireup="false" CodeFile="ViewData1.aspx.cs" Inherits="ablesas.ViewDataUI1" EnableEventValidation="false"%>


            <asp:UpdatePanel ID="UpdatePanel4" runat="server">
                        <ContentTemplate>

                                         <asp:GridView ID="DataGrid1"  style="visibility:visible" runat="server" AlternatingRowStyle-BackColor="#E9EDF5"  Font-Names="Arial"
                                                ForeColor="#09538A" Font-Size="12px" BackColor="#ffffff" BorderColor="DarkGray" Font-Bold="true" 
                                                HeaderStyle-BackColor="#298DC7" EnableViewState="false"  CellSpacing="20" 
                                                CellPadding="10"  HeaderStyle-Font-Bold="true"  AutoGenerateColumns="False" OnRowCommand="DataGrid1__RowCommand" OnRowDataBound="DataGrid1__RowDataBound" >
                                                <HeaderStyle Font-Names="Arial;" CssClass="MyHeaderStyle" Font-Size="13px" ForeColor="White" Font-Bold="True" Height="20"  BackColor="#298DC7" ></HeaderStyle>
        <asp:templatefield headertext="NDC" ItemStyle-CssClass="col" ItemStyle-HorizontalAlign="Justify" HeaderStyle-Width="10%" ItemStyle-Width="10%">                                     <Columns>               
                    <itemtemplate>
                    <asp:linkbutton id="productcode"   ForeColor="#09538A" runat="server"  text='<%#Eval("product code")%>'></asp:linkbutton>                               

                                                     </itemtemplate>
                                        </asp:templatefield>
                   </asp:GridView>
                                </ContentTemplate>
                </asp:UpdatePanel>


                                        <AjaxToolkit:ModalPopupExtender ID="ModalPopupExtender1"   BackgroundCssClass="modalBackground" CancelControlID="cancel" TargetControlID="Button3" runat="server" PopupControlID="pnlpopup"> </AjaxToolkit:ModalPopupExtender>
    <asp:Panel id="Panel1"  runat="server" Height="30px" Width="600px">
    </asp:Panel>        
                   <asp:Button ID="Button3" runat="server" style="visibility:hidden" Text="Button" />
                            <asp:Panel ID="pnlpopup" CssClass="PanelPopup"  runat="server">
                                        <div  style="width:inherit;text-align:center;">Products of <%=ndc %> Product Family</div>
                                        <asp:GridView ID="GridView1"  runat="server" AlternatingRowStyle-BackColor="#f1f4f8"  Width="980px" Font-Names="Arial"
                                            Font-Bold="True" ForeColor="#09538A" Font-Size="13px" BackColor="#ffffff" BorderColor="DarkGray"
                                            HeaderStyle-BackColor="#99cccc" EnableViewState="false"  CellSpacing="0" style="padding:10px;"
                                            CellPadding="3" ShowFooter="false" AllowPaging="True" AutoGenerateColumns="False" OnRowDataBound="productInfo_RowDataBound" >
                                            <HeaderStyle Height="10%" CssClass="MyHeaderStyle" Font-Size="13px" ForeColor="#FFFFFF" Font-Bold="true"  BackColor="#298DC7"></HeaderStyle>
                                            <rowstyle Height="20px" />
                        <alternatingrowstyle  Height="20px"/>
                                            <Columns>
                <asp:boundfield  datafield="product code" sortexpression="customers " ItemStyle-CssClass="col" headertext="NDC"/>

             <div id="div<%#  Convert.ToString(Eval("customer"))+ Convert.ToString(Eval("ManufacturingPartner"))+ Convert.ToString(Eval("product code"))+ Convert.ToString(Eval("Sales Person")) %>" style="display: none; position: relative; left: 15px; overflow: auto">
                                        <asp:GridView ID="gvOrderInfo" runat="server" ForeColor="#09538A"  AutoGenerateColumns="false" BorderStyle="Double"  BorderColor="#df5015"  Width="500px" OnRowDataBound="gvOrderInfo_RowDatabound">
                                        <HeaderStyle CssClass="MyHeaderStyle"  Font-Size="13px" ForeColor="#FFFFFF" Font-Bold="True"  BackColor="#298DC7"></HeaderStyle>
                                        <RowStyle BackColor="#E1E1E1" />
                                        <AlternatingRowStyle BackColor="White" />
                                        <HeaderStyle BackColor="#df5015" Font-Bold="true" ForeColor="White" />
                                        <Columns>
              <asp:BoundField DataField="Order Number" HeaderText="Order Number" ItemStyle-Width="75px" ItemStyle-CssClass="col" HeaderStyle-HorizontalAlign="Left" />
                  </Columns>   
              </Columns>                            
                                        </asp:GridView>
                                    </div>                         
                                            </asp:GridView>
             </asp:Panel>

代码隐藏

  protected void DataGrid1__RowDataBound(Object sender, GridViewRowEventArgs e)
    {    
         this.UpdatePanel4.Update();
         if (e.Row.RowType == DataControlRowType.DataRow)
         {
              LinkButton lnk = e.Row.FindControl("productcode") as LinkButton;
              lnk.Click += new EventHandler(link_Click);

              //ScriptManager.GetCurrent(this).RegisterPostBackControl(lnk); 

              // string a = String.Format("0:N}",Convert.ToDecimal(e.Row.Cells[3].Text));
              if (e.Row.Cells[0].Text != "Total")
              {
                    //M1-Fmodification starts from here
                    if (ListBox2.Items.Count > 0)
                    //if (DataGrid1.Columns[0].Visible == true)
                    {
                    }              
              }
         }
    }

代码隐藏

 public void productcode_Click(object sender, EventArgs e)
        {
            pnlpopup.Visible = true;
            //UpdatePanel3.Update();
            //this.UpdatePanel3.Update();
            GridViewRow clickedRow = ((LinkButton)sender).NamingContainer as GridViewRow;
            LinkButton lbtn = (LinkButton)clickedRow.FindControl("productcode");
            string customer = clickedRow.Cells[0].Text.ToString();
            string manufacturer = clickedRow.Cells[5].Text.ToString();
            string salesperson = clickedRow.Cells[6].Text.ToString();
            System.Data.DataTable newProductTable = null;
            ArrayList productDrilldownList = new ArrayList();
            productDrilldownList.Add(customer);
            productDrilldownList.Add(manufacturer);
            productDrilldownList.Add(lbtn.Text);
            productDrilldownList.Add(salesperson);


            try
            {
                ViewData1 vData = new ViewData1();
                DataSet ds1 = vData.__getProdOverviewDataSet(__getConnectionString());
                DataSet ds2 = vData.__getCustOverviewDataSet(__getConnectionString());
                DataSet ds3 = vData.__getSalesOverviewDataSet(__getConnectionString());
                DataSet ds4 = vData.__getManOverviewDataSet(__getConnectionString());
                DataSet ds5 = vData.__getBookedDateDataSet(__getConnectionString());

                List<DateTime> booked_date = new List<DateTime>();

                if (ds5.Tables[0].Rows.Count > 0)
                {
                    foreach (DataRow row in ds5.Tables[0].Rows)
                    {
                        if (row[0].ToString() != " " && row[0] != null)
                        {
                            booked_date.Add(Convert.ToDateTime(row[0]));
                        }
                    }
                }
                booked_date.Remove(Convert.ToDateTime("1/1/0001 12:00:00 AM"));
                booked_date.Sort();
                ArrayList daterange = new ArrayList();
                daterange = _getDateRange();
                if (Convert.ToDateTime(daterange[0]) > Convert.ToDateTime(daterange[1]))
                {
                 //   DataGrid1.Visible = false;
                 //   Label4.Visible = false;
                //    TxtCustProd.Visible = false;
                //    Panel1.Visible = false;
                //    ClientScript.RegisterClientScriptBlock(GetType(), "Javascript", "<script>alert('There is no data found')</script>");
                //    return;
                }
                if (ToDateTxtBox.Text != "" && ToDateTxtBox.Text != "To Date" && FromDateTxtBox.Text != "From Date")
                {
                    DropDownList2.Text = "Months";
                    DropDownList3.Text = "Years";
                    if (!booked_date.Contains(Convert.ToDateTime(daterange[2])) && !booked_date.Contains(Convert.ToDateTime(daterange[3])))
                    {
                     //   DataGrid1.Visible = false;
                     //   Label4.Visible = false;
                    //    TxtCustProd.Visible = false;
                    //    Panel1.Visible = false;
                    //    ClientScript.RegisterClientScriptBlock(GetType(), "Javascript", "<script>alert('There is no data found')</script>");
                    }
                }
                else
                {
                    ToDateTxtBox.Text = "";
                    FromDateTxtBox.Text = "";
                }




                int countCustomer = -1;
                int countProduct = -1;
                int countSales = -1;
                int countMan = -1;
                if (ds1.Tables[0].Rows.Count > 0)
                {
                    countProduct = ds1.Tables[0].Rows.Count;
                }
                if (ds2.Tables[0].Rows.Count > 0)
                {
                    countCustomer = ds2.Tables[0].Rows.Count;
                }
                if (ds3.Tables[0].Rows.Count > 0)
                {
                    countSales = ds3.Tables[0].Rows.Count;
                }
                if (ds4.Tables[0].Rows.Count > 0)
                {
                    countMan = ds4.Tables[0].Rows.Count;
                }


                System.Data.DataTable dt = new System.Data.DataTable();
                string test = "";
                if(Session["callcount"] != null){
                    string coo = Session["callcount"].ToString(); 
                    int coi = Int16.Parse(coo);
                    Session["callcount"] = coi + 1;
                    test = Session["callcount"].ToString();
                }
                else{
                    int coi = 0;
                    Session["callcount"] = coi.ToString();
                    test = Session["callcount"].ToString();
                }
                dt = vData.__getProductLevelSource(__getConnectionString(), __getDropDownValues(), __getProdFilterValues(), __getCustFilterValues(), __getSalesFilterValues(), __getManFilterValues(), countCustomer, countProduct, countSales, countMan, _getDateRange(), __getProdFamilyFilterValues(), productDrilldownList);
                GridView1.DataSource = dt;
                GridView1.DataBind();
                //dt.Rows.Count
                Gridview_Columnshide(GridView1);
            }
            catch (Exception dateerr)
            {
                //DataGrid1.Visible = false;
                //Label4.Visible = false;
                //TxtCustProd.Visible = false;
                //Panel1.Visible = false;
                //ClientScript.RegisterClientScriptBlock(GetType(), "Javascript", "<script>alert('There is no data found')</script>");

            }

            ModalPopupExtender1.Show();
            //UpdatePanel3.Update();

        }

请尝试在更新面板中添加模型弹出扩展器。然后它将弹出而不刷新页面。这是示例代码。这个工作正常,没有任何问题。再检查一次

  <asp:UpdatePanel runat="server">
    <ContentTemplate>



        <asp:GridView ID="DataGrid1" runat="server" OnRowDataBound="DataGrid1__RowDataBound">

            <Columns>
                <asp:BoundField DataField="ID" HeaderText="Value" />
                <asp:TemplateField HeaderText="NDC" ItemStyle-CssClass="col" ItemStyle-HorizontalAlign="Justify" HeaderStyle-Width="10%" ItemStyle-Width="10%">

                    <ItemTemplate>
                        <asp:LinkButton ID="productcode" ForeColor="#09538A" runat="server" Text='click'></asp:LinkButton>

                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>
        </asp:GridView>



        <AjaxToolkit:ModalPopupExtender ID="ModalPopupExtender1" TargetControlID="Button3" runat="server" PopupControlID="pnlpopup"></AjaxToolkit:ModalPopupExtender>

        <asp:Button ID="Button3" runat="server" Style="visibility: hidden" Text="Button" />
        <asp:Panel ID="pnlpopup" CssClass="model-bd" runat="server">
            <input type="button" value="ok">
        </asp:Panel>
    </ContentTemplate>
</asp:UpdatePanel>

- - - - - C# - - - - - -

   protected void Page_Load(object sender, EventArgs e)
    {

        DataTable dt = new DataTable();
        dt.Columns.Add("ID");
        DataRow dr = dt.NewRow();
        DataRow dr1 = dt.NewRow();
        dr["ID"] = 1;
        dr1["ID"] =21;
        DataGrid1.DataSource = dt;
        dt.Rows.Add(dr);
        dt.Rows.Add(dr1);
        DataGrid1.DataBind();
    }
    protected void DataGrid1__RowDataBound(Object sender, GridViewRowEventArgs e)
    {

        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            LinkButton lnk = e.Row.FindControl("productcode") as LinkButton;
            lnk.Click += new EventHandler(productcode_Click);


        }
    }
     void productcode_Click(object sender, EventArgs e)
    {
        pnlpopup.Visible = true;



        ModalPopupExtender1.Show();


    }
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

单击网格中的 LinkBut​​ton 时避免页面刷新 的相关文章

  • 如何为 C 分配的 numpy 数组注册析构函数?

    我想在 C C 中为 numpy 数组分配数字 并将它们作为 numpy 数组传递给 python 我可以做的PyArray SimpleNewFromData http docs scipy org doc numpy reference
  • 将内置类型转换为向量

    我的 TcpClient 类接受vector
  • 互斥体实现可以互换(独立于线程实现)

    所有互斥体实现最终都会调用相同的基本系统 硬件调用吗 这意味着它们可以互换吗 具体来说 如果我使用 gnu parallel算法 使用openmp 并且我想让他们称之为线程安全的类我可以使用boost mutex用于锁定 或者我必须编写自己
  • XamlReader.Load 在后台线程中。是否可以?

    WPF 应用程序具有从单独的文件加载用户控件的操作 使用XamlReader Load method StreamReader mysr new StreamReader pathToFile DependencyObject rootOb
  • 单元测试一起运行时失败,单独运行时通过

    所以我的单元测试遇到了一些问题 我不能只是将它们复制并粘贴到这里 但我会尽力而为 问题似乎是 如果我一项一项地运行测试 一切都会按预期进行 但如果我告诉它一起运行测试 则 1 5 将通过 TestMethod public void Obj
  • 将 System.Windows.Input.KeyEventArgs 键转换为 char

    我需要将事件参数作为char 但是当我尝试转换 Key 枚举时 我得到的字母和符号与传入的字母和符号完全不同 如何正确地将密钥转换为字符 这是我尝试过的 ObserveKeyStroke this new ObervableKeyStrok
  • 存储来自其他程序的事件

    我想将其他应用程序的事件存储在我自己的应用程序中 事件示例 打开 最小化 Word 或打开文件时 这样的事可能吗 运行程序 http msdn microsoft com en us library ms813609 aspx and 打开
  • 在 C# 中循环遍历文件文件夹的最简单方法是什么?

    我尝试编写一个程序 使用包含相关文件路径的配置文件来导航本地文件系统 我的问题是 在 C 中执行文件 I O 这将是从桌面应用程序到服务器并返回 和文件系统导航时使用的最佳实践是什么 我知道如何谷歌 并且找到了几种解决方案 但我想知道各种功
  • 用于检查项目文件中的项目变量和引用路径的 api

    我正在研究一个 net application VS2010 与 x 没有 解和变量号这些解决方案中的项目数量 我需要检查项目属性 特定于一定数量的项目 是否同质 并且检查 验证构建期间的参考路径 有没有一个API是这样的吗 如果没有 我该
  • C# Dns.GetHostEntry 不返回连接到 WiFi 的移动设备的名称

    我有一个 C 中的 Windows 窗体应用程序 我试图获取列表中所有客户端的主机名 下面给出的是 ra00l 来自此链接的代码示例 GetHostEntry 非常慢 https stackoverflow com questions 99
  • 将 Excel 导入到 Datagridview

    我使用此代码打开 Excel 文件并将其保存在 DataGridView 中 string name Items string constr Provider Microsoft Jet OLEDB 4 0 Data Source Dial
  • 使用 JNI 从 Java 代码中检索 String 值的内存泄漏

    我使用 GetStringUTFChars 从使用 JNI 的 java 代码中检索字符串的值 并使用 ReleaseStringUTFChars 释放该字符串 当代码在 JRE 1 4 上运行时 不会出现内存泄漏 但如果相同的代码在 JR
  • PlaySound 可在 Visual Studio 中运行,但不能在独立 exe 中运行

    我正在尝试使用 Visual Studio 在 C 中播放 wav 文件 我将文件 my wav 放入项目目录中并使用代码 PlaySound TEXT my wav NULL SND FILENAME SND SYNC 我按下播放按钮 或
  • 上下文敏感与歧义

    我对上下文敏感性和歧义如何相互影响感到困惑 我认为正确的是 歧义 歧义语法会导致使用左推导或右推导构建多个解析树 所有可能的语法都是二义性的语言是二义性语言 例如 C 是一种不明确的语言 因为 x y 总是可以表示两个不同的事物 如下所述
  • 禁用 iframe 中的滚动

    有没有办法在 iframe 中禁用所有滚动 我有一个 iframe 其中内容超出了 iframe 尺寸 设置scrolling no 只会删除滚动条 但不会禁用滚动 我无法控制 iframe html 的头部 所以我无法设计它的样式 有任何
  • std::async 与重载函数

    可能的重复 std bind 重载解析 https stackoverflow com questions 4159487 stdbind overload resolution 考虑以下 C 示例 class A public int f
  • 有没有办法强制显示工具提示?

    我有一个验证字段的方法 如果无法验证 该字段将被清除并标记为红色 我还希望在框上方弹出一个工具提示 并向用户显示该值无效的消息 有没有办法做到这一点 并且可以控制工具提示显示的时间 我怎样才能让它自己弹出而不是鼠标悬停时弹出 If the
  • 如何将 Roslyn 语义模型返回的类型符号名称与 Mono.Cecil 返回的类型符号名称相匹配?

    我有以下代码 var paramDeclType m semanticModel GetTypeInfo paramDecl Type Type Where paramDeclType ToString returns System Col
  • 防止在工厂方法之外实例化对象

    假设我有一个带有工厂方法的类 class A public static A newA Some code logging return new A 是否可以使用 a 来阻止此类对象的实例化new 那么工厂方法是创建对象实例的唯一方法吗 当
  • 在客户端系统中安装后桌面应用程序无法打开

    我目前正在使用 Visual Studio 2017 和 4 6 1 net 框架 我为桌面应用程序创建了安装文件 安装程序在我的系统中完美安装并运行 问题是安装程序在其他计算机上成功安装 但应用程序无法打开 edit 在客户端系统中下载了

随机推荐

  • 如何用Python打印一块板子?

    我试图在Python上编写一个名为三重三元组的游戏 但是我对棋盘的输出有一个问题 它必须像这样每个方格 其中每个数字代表一个基点 有9个方格 每个方格三个线 1 1 9 2 3 1 6 7 2 4 1 2 我想为每一行做一个列表 并用每个基
  • 创建一个 Apache SetEnv 变量,其中包含通配符的子域名

    我有一个网站 基本上设置如下 client name website com 其中 clientname 实际上是通配符 对于每个新客户 我基本上都会创建一个子域 我需要直接从 Apache 自动获取客户端名称信息 例如 如果有人经历了 c
  • puppeteer - 如何从具有多个同一类的 div 的页面中提取内容

    我有一个简单的木偶脚本来抓取公告网站 我需要获取页面的内容 在检查 DOM 后 我可以看到所有内容对于包含链接和文本的 div 都具有相同的类 如何通过循环获取每个div的内容 这是一个页面html结构的例子 大约有二十五个相同类的div
  • ggplot barplot 根据两个类别的行的最大值进行排序

    我四处搜寻并发现和我类似的案例 https stackoverflow com questions 33127081 但我找不到以下问题的有效解决方案 我有一个像这样的数据框 df lt data frame name rep c a b
  • 不唯一的表/别名

    我收到错误ERROR 1066 42000 Not unique table alias 我不知道出了什么问题 SELECT Project Assigned ProjectID Project Title Account Account
  • TensorFlow 目标检测 API 的非极大值抑制

    我正在 Tensorflow 对象检测 API 中实现 Faster RCNN v2 Inception 为了消除冗余重叠检测 我读到应该应用 NMS 一种方法是调整配置文件中的 NMS IOU 阈值first stage nms iou
  • JavaScript 运行时如何表示闭包和作用域

    这主要是出于好奇而提出的问题 考虑以下函数 var closure function f0 var x new BigObject var y 0 closure function return 7 function f1 var x Bi
  • 绑定到 Twitter Bootstrap 3 中的 Collapse 事件

    假设我有 Bootstrap Collapse div class panel group div class panel panel default div class panel heading h4 class panel title
  • 错误:入口点不在当前项目内

    无法从 Android Studio 运行 flutter 未检测到 flutter 项目 其显示错误 入口点不在当前项目内 每次重新启动 android studio 时都会显示相同的错误消息 删除 ideaflutter 项目根目录下的
  • 使用 UIWebView 进行手势识别

    我在我正在构建的应用程序中设置了一些手势识别功能 其中一种手势是单指单击 它会隐藏屏幕顶部的工具栏 效果很好 除了一件事 点击链接也会导致工具栏消失 是否可以检测到不是链接点击的点击 我可以通过查看点击发生的位置来做到这一点 并且仅在 ht
  • 如何正确使用insertRowsAtIndexPaths?

    我浏览了在线的所有示例 但无法弄清楚如何正确地将单元格添加到带有动画的表格视图中 假设我有一个包含一个单元格的部分 当用户单击第一个单元格的附件时 我想添加另一个单元格 我的 添加 方法执行以下操作 IBAction toggleEnabl
  • Qt状态栏颜色

    我将 Qt 与 Python 结合使用 并且有一个底部带有状态栏的主窗口 我可以使用 QLabel 在栏中显示一条消息 并使用类似的方法设置该消息的颜色 font color In progress font 对于 QLabel 文本 我还
  • GO - 本地导入不起作用

    我是 golang 新手 我想构建我的第一个简单的 Web 应用程序 每次我想构建源代码时 都会收到错误locale import controllers in non local package 这是我的文件夹结构 goTest Dock
  • 在arm64上安装构建工具不起作用

    我一直在尝试安装sdkmanager build tools 30 0 2 在arm64处理器 安培CPU 上 但每次我得到这个 Warning Dependant package with key emulator not found W
  • 如何通过 apache 渲染 .phtml 文件

    我想通过 Apache 渲染 phtml 文件 但是当我尝试时 它会将页面渲染为文本而不是 html 在我的虚拟主机配置中 如果我尝试渲染index php 它会正确执行 但是 当我将 DirectoryIndex 更改为 index ph
  • 如何通过asp.net mvc中的api调用将文件上传到服务器上

    public ActionResult Index PublishPost post HttpPostedFileBase file var apiURL http test sa com rest social update 1161 u
  • 内核清零内存?

    我正在使用 Debian squeeze 并注意到内存总是归零 这是 Linux 发行版中的新功能吗 前段时间 我相信我可以使用 put 并且会输出垃圾 我多次运行这个测试程序 但注释的结果总是相同的 我在 sysctl conf 中有 r
  • 如何根据谷歌地图中标记的相对位置制作多边形?

    我有一个标记列表 我想在其周围创建一个多边形 显示标记周围的区域 而不是标记本身 因此 我希望多边形 包裹 在标记周围以显示它们周围的相对区域 而不是让多边形点成为标记的直接纬度 经度 关于我如何完成这样的事情有什么想法吗 这被称为凸包 有
  • 需要对开发者控制台上的 beta/alpha 测试进行一些说明

    背景 Android 开发者控制台有 3 个选项卡用于发布应用程序的 apk 文件 alpha beta 和 production 如下所示 我记得在一次 Google IO 讲座中 在进行 100 规模发布之前检查应用程序的好坏的一个很酷
  • 单击网格中的 LinkBut​​ton 时避免页面刷新

    我有一个GridView控件 并且在该控件内部我使用定义了一个链接按钮GridView ItemTemplate 我用它来点击打开一个新窗口 但是 当我单击链接按钮时 页面会在打开新窗口之前刷新 单击链接按钮后如何阻止页面刷新 当我将更新面