每次我在IE8Version中展开和折叠树视图时都会询问确认消息。 [英] confirmation message asked every time I expand and collapse treeview in IE8Version.

查看:77
本文介绍了每次我在IE8Version中展开和折叠树视图时都会询问确认消息。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



在我的网页上,当我离开页面并浏览新页面时,我会显示确认消息。它工作正常。但我的一个页面有树视图。在该页面上,每次我展开和折叠树视图时都会询问确认消息。我们如何避免它。请帮我解决这个问题。

我的编码是



Hi
In my webpage, I show confirm message when I leave the page and navigate new page. It is working fine. But one of my page has treeview. On that page only every time I expand and collapse treeview It asks confirmation message. How we avoid it. Please help me, for this problem.
My coding is

<script type="text/javascript" language="javascript">
       window.onbeforeunload = function () {
          
           if (document.getElementById("<%=hdnSavingMode.ClientID %>").value.toUpperCase() == 'TRUE') {
               return "Do you want to leave this page without saving?";

           }
       };
    </script>





只有IE不在Firefox中。我正在使用IE 8版本。



It happens only IE not in firefox. I am using IE 8 version.

推荐答案

这实际上在IE8中正常工作并在Firefox中被破坏。每次页面回发时都会触发此事件,这就是您在使用树视图时看到它的原因。 Firefox有一个已知问题,即返回的文本不会显示给用户(这里 [ ^ ],此处 [ ^ ]) 。对firefox使用onbeforeunload的正确方法是:



This is actually working correctly in IE8 and broken in Firefox. This event will fire every time page posts back, which is why you are seeing it when using the treeview. Firefox has a known issue where the returned text is not displayed to the user (Here[^], Here[^]). The correct way to use onbeforeunload for firefox is:

<script type="text/javascript" language="javascript">
       window.onbeforeunload = function (event) {
          
           if (document.getElementById("<%=hdnSavingMode.ClientID %>").value.toUpperCase() == 'TRUE') {
               if(event != null && typeof(event) != 'undefined')
                   event.returnValue = "Do you want to leave this page without saving?";
               return "Do you want to leave this page without saving?";
 
           }
       };
    </script>


Hai


你的树视图中的
展开和折叠页面命中服务器,所以在页面onbeforeunload事件触发时,所以在展开或折叠treeview时尽量避免页面刷新,所以使用更新面板进行树视图,避免页面重新加载,



你必须将确认消息移动到服务器端按钮点击事件而不是客户端或使用客户端按钮点击事件不要使用窗口事件,











Hai

in ur treeview expand and collapse page hit the server,so in page onbeforeunload event fires,so try to avoid page refresh when expand or collapse treeview,so use update panel for treeview,it avoid page reload,

U have to move confirm message to server side button click event instead of client side or use client side button click event dont use window event,





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

                                  </ContentTemplate>
                              </asp:UpdatePanel>




树视图中的
在服务器中展开和折叠一边?,尝试扩展和折叠客户端。一边





问候

Aravind



in treeview expand and collapse u did in server side ?,try to expand and collapse form client. side


regards
Aravind


这篇关于每次我在IE8Version中展开和折叠树视图时都会询问确认消息。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆