如何使用javascript或jquery处理母版页回发 [英] How to handle master page postback using javascript or jquery

查看:101
本文介绍了如何使用javascript或jquery处理母版页回发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的Web应用程序中,我使用SQL Server 2008集成了一个在asp.net,Jquery和Web服务中开发的聊天应用程序,并为此创建了一个用户控件.我在母版页上使用此用户控件.


我的问题是-我正在聊天,如果有任何回发,而每次回发都关闭了chatbox,如何处理此问题,请帮帮我....


在此先感谢...

In my web application i have integrated a Chat Application developed in asp.net, Jquery and web services using sql server 2008. and i create a user control for it. i use this user control at master page.


my problem is-- i m in a chatting if there is any postback than chatbox is closed for every postback how to handle this problem please help me....


thanks in advance...

推荐答案

基尔蒂,

根据我对问题的了解,当您回发页面时,页面上的所有内容都会丢失.

我认为您必须限制回发.如果按照要求这不是可行的解决方案,那么您可能会考虑实现部分回发,以使使用JavaScript创建的控件不会发送回服务器,因此控件不会在回发时丢失.

请让我知道是否还有其他疑问.

-DD
Hi Kirti,

As per my understanding of the problem is when you postback your page, everything is lost from the page.

I think you have to restrict postback. If that''s not feasible solution as per the requirement, then you may think of implementing partial postback so that controls created using JavaScript are not sent back to server hence the controls will not get lost over the postback.

Please let me know if there are any further queries.

-DD


尝试一下:

在主页面的"Page_Load" 事件中添加以下条件


Try this :

Add below condition in "Page_Load" event of master page


if (!Page.IsPostBack)
{
    //Your Code
}


在代码隐藏页"中添加以下代码:
Add below code in Code Behind Page:
if (IsPostBack)
{
    //Registering HiddenField for PostBack
    ClientScript.RegisterHiddenField("IsPostBack", "1");
}




jQuery代码:




JQuery Code:

if (


这篇关于如何使用javascript或jquery处理母版页回发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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