JQueryMobile对话框显示因回发两次 [英] JQueryMobile dialog shows twice because of a postback

查看:188
本文介绍了JQueryMobile对话框显示因回发两次的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个asp.net页面中嵌入一个UpdatePanel计时器(的UpdateMode =条件,ChildrenAsTriggers =假)。定时器负责更新每隔几秒该网页的某些组件。

I have an asp.net page with a timer embedded in an UpdatePanel (UpdateMode="Conditional", ChildrenAsTriggers="false"). The timer is responsible for updating some components of that page every few seconds.

有也页面上有些超链接控制和点击时(数据的rel =对话),他们打开JQueryMobile对话框。问题是,在计时器我提到的原因每隔几秒回发。因此,当打开一个对话框,然后关闭,再经过第一个这样的回发会导致对话框再次打开。

There are also some HyperLink controls on the page and they open a JQueryMobile dialog when clicked (data-rel="dialog"). The problem is that the timer i mentioned causes postback every few seconds. So when a dialog is opened and then closed, the first such postback after then causes the dialog to open once again.

使用rel =外部正如我所说的超链接的另一个属性解决了这个问题,但是这对我来说是无解的。这将导致完全重定向到对话框页面,而不是显示它使用AJAX(好像在当前页面的顶部)。

Using the rel="external" as another attribute of the HyperLinks I mentioned solves the problem, but this is no solution for me. This causes full redirection to the dialog page instead of showing it using AJAX (as if on top of current page).

我的想法是被点击任何超链接时,停止计时器。这解决了这个问题,但我不知道如何在对话框关闭时再启动定时器。是否有可能在关闭一个JQueryMobile对话框来检测?我知道,这听起来很愚蠢,但我不能想出更好的主意。你能帮我,好吗?

My idea was to stop the timer when any hyperlink is clicked. This solves the problem, but I have no idea how to start the timer again when the dialog closes. Is it possible to detect when a JQueryMobile dialog is closed? I know, this sounds stupid, but I can't come up with a better idea. Will you help me, please?

所以基本上,我不希望JQueryMobile对话页面显示为一个时钟滴答后的第二次。能否请你告诉我如何做到这一点?

So basically, I don't want the JQueryMobile dialog page to show up for the second time after a timer tick. Could you please advise me how to achieve that?

推荐答案

jQuery Mobile的使用asp.net Web窗体和 UpdatePannel ?这只是听起来像一个可怕的组合。

jQuery Mobile with asp.net Web Forms and an UpdatePannel? This just sounds like a horrible combination.

jQuery Mobile的和Web Forms根本不能很好地协同工作。换行所有控件元素(和大部分内容);具体的问题,Web窗体需要一个单一的<形式/过夜。 jQuery Mobile的试图建立与通过AJAX加载虚拟页的DOM。这通过提交整个表单,而不是每个页面模板中发现的单一形式打破了回传模式。现在扔的UpdatePanel 在那里...

jQuery Mobile and Web Forms fundamentally don't work well together. The specific issue that Web Forms requires a single <form /> element that wraps all controls (and most content). jQuery Mobile attempts to build up the DOM with "virtual" pages via ajax loading. This breaks the PostBack model by submitting the entire form instead of the individual form found within each page template. Now throw UpdatePanels in there...

您唯一的希望是单页模板专门去并禁用所有的Ajax加载数据AJAX =FALSE两个链接和表单。而刚刚说不的UpdatePanel

Your only hope is go exclusively with Single page templates and to disable all ajax loading data-ajax="false" on both links and forms. And just say no to UpdatePanels.

asp.net MVC会给你在这些问题上更大的控制权。

asp.net MVC would give you much greater control over these issues.

这篇关于JQueryMobile对话框显示因回发两次的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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