jQuery Mobile的:获取取消回发是造成页面加载错误 [英] Jquery Mobile: Getting a cancelled Postback that's causing a page load error

查看:295
本文介绍了jQuery Mobile的:获取取消回发是造成页面加载错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以,我一直在努力,现在得到这个页面了几天的工作,当我点击发送按钮,它会工作,但如果你想打进入它只是做回发到同一页。昨天我以为我终于得到了它,所以它会在Chrome浏览器(它一直在Firefox不错,但上破的镀铬/ Safari浏览器,它是为iPhone应用程序)。但是,即使我终于得到了它,所以它会改变页,现在是显示错误。我缩小的原因到我要被发送,然后取消回发之前正确的,是被称为回发。我认为取消的回发是空白的,因为我是有这个问题是页面会做一个空白的回发。

So, I've been trying to get this page working for a couple of days now, when I clicked the send button it would work, but if you tried to hit enter it would just do a postback to the same page. Yesterday I thought I finally got it so it would work on chrome (it has been working just fine on firefox, but breaking on chrome/safari and it is an app for the iphone). But, even though I finally got it so it would change pages, it is now displaying an error. I narrowed down the cause to a postback that is being called right before the postback I want is being sent which is then cancelled. I assume the cancelled postback is blank because the problem I was having was the page would do a blank postback.

我加入固定的问题。

javascript:if (event.keyCode == 13) __doPostBack('" & btnSearch.UniqueID & "','') 

到安其preSS的txtSearch。 LinkBut​​ton的和ASP:为ASP的结束HTML文本框(这是封闭在一个asp:面板,里面的asp:内容母版页这是一个形式里面,可能会或可能不相关)是

to the onKeyPress for txtSearch. The ending html for the asp:LinkButton and asp:TextBox (which is enclosed in an asp:Panel, inside an asp:Content for a master page which is inside a form, may or may not be relevant) is

<input name="ctl00$contentMain$txtSearch" id="contentMain_txtSearch" type="text" data-type="search" onkeypress="javascript:if (event.keyCode == 13) __doPostBack('ctl00$contentMain$btnSearchByIDName','')" class="...">

<a id="contentMain_btnSearch" class="..." data-role="button" onclientclick="return false;" href="javascript:__doPostBack('ctl00$contentMain$btnSearch','')" data-theme="c"><span class="..."><span class="...">Search</span></span></a>

有在code背后的一个按钮单击事件。

There is an on button click event in the code behind.

这是从帖子,响应和其他一切头是空的。

This is the header from the post, the response and everything else is empty.

Accept:text/html, */*; q=0.01
Content-Type:application/x-www-form-urlencoded
Origin:Local.Website
Referer:Local.Website/EmployeePhoneList/PhoneList.aspx
User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/14.0.835.186 Safari/535.1
X-Requested-With:XMLHttpRequest

任何人有任何想法如何弄清楚它为什么做两回发?或如何我能确定是什么原因造成的呢?感谢您的帮助。

Anyone have any ideas how to figure out why it is doing two postbacks? Or how I could determine what is causing it? Thanks for any help.

更新:进一步展望响应,btnSearch是两种不正确的,正确的回发的根源。此外,东西没有的工作,的AutoPostBack =假,CauseValidation =假,ViewStateMode =Disabled并UseSubmitBehavior =假。

Update: Looking further into the response, btnSearch is the origin for both the incorrect and correct postbacks. Also, things that HAVE NOT worked, AutoPostBack="false", CauseValidation="false", ViewStateMode="Disabled" and UseSubmitBehavior="false".

推荐答案

而在另一页上的固定看似无关的问题,我们意外地解决了这个问题。原来即使ajaxEnabled =假,你有时需要在母版的形式把数据阿贾克斯=假,使asp.net code使用jQuery Mobile正常工作。无论是或RC1解决了这个问题,我不知道你肯定在这一点上我真的不关心了。

While fixing an seemingly unrelated problem on another page we accidentally fixed the problem. Turns out even with ajaxEnabled = false, you sometimes need to put data-ajax="false" in the form of the masterpage to make asp.net code work correctly with JQuery mobile. Either that or rc1 fixed the problem, I don't know for sure and at this point I don't really care anymore.

这篇关于jQuery Mobile的:获取取消回发是造成页面加载错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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