关闭网络应用.在不同条件下通过查询字符串 [英] Close the web app. on different conditions by query string

查看:73
本文介绍了关闭网络应用.在不同条件下通过查询字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨.朋友,我的.net应用程序中有一个网页,我的问题是,我在页面网址中查询了 mn .我的条件是,当 mn = 0 此处关闭浏览器时未显示任何消息,而当 mn> 0 时则显示您确定关闭此页面"的消息.

如果有人对此有任何想法,请帮助我.

谢谢&问候

Parveen Rathi

Hi. friends, I have a web page in my .net application, my problem is that, I have a querysting mn in the page url. My condition is that when mn=0 here is not any message when closing the browser but when mn>0 then here is a message to "Are u sure to close this page".

If any body have some idea about this, please help me.

Thanks & Regards

Parveen Rathi

推荐答案

if(Convert.ToInt32(Request.QueryString["mn"])>0)
            {
                Button1.Attributes.Add("onclick", "confirm('Are you sure')");
            }


<script  type ="text/javascript" language ="javascript"  >

function unload()
    {

       var Flg= document.getElementById('hdn');
        if (parseInt(Flg.value)>0)
        {
            event.returnValue = "Are u sure to close this page";
        }
    }
</script>

<body  onbeforeunload="unload()" onload ="AutoSave()"  >
    <form id="form1" runat="server"  >

<asp:HiddenField ID="hdn" runat="server" />


on page load add value of querry string to this hidden field




会起作用




it will work


这篇关于关闭网络应用.在不同条件下通过查询字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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