简体   繁体   English

从移动设备查看的asp.net页面上的回发问题

[英]Issue with postbacks on asp.net pages viewed from mobile device

I am facing an awkward problem. 我面临着一个尴尬的问题。 I am working on a .NET web site for which we are making a mobile version as well. 我正在开发一个.NET网站,我们也正在制作移动版本。 The mobile version seems to be working fine when I am viewing it from the browser on my laptop, but when viewing it from a mobile device (in my case HTC running on Android), there is a problem on button clicks. 当我从笔记本电脑上的浏览器中查看移动版时,移动版似乎工作得很好,但是当从移动设备上查看它时(在我的例子中是在Android上运行的HTC),按钮点击有问题。 The postbacks simply freeze the page and after some time "Web page not available" is displayed. 回发只是冻结页面,并在一段时间后显示"Web page not available" Even for simple cancel buttons that only have Response.Redirect associated with them. 即使是只有与它们相关的Response.Redirect简单取消按钮。

Has anyone witnessed similar situation? 有谁目睹了类似的情况? Any ideas on what can cause this? 关于什么可能导致这个的任何想法? I am using .NET 3.5. 我使用的是.NET 3.5。

The postbacks work through inserted JavaScript (__doSubmit ). 回发通过插入的JavaScript (__doSubmit )工作。 Mobile devices have patchy support for JavaScript. 移动设备对JavaScript有不完整的支持。 Is it possible to look at the device capabilities for instance by hooking into a WURFL database and look at the device capabilities. 是否可以通过挂钩到WURFL数据库并查看设备功能来查看设备功能。 I could well imagine that this would be a problem for lower end devices but I am a bit surprised about HTC Andriod devices. 我可以想象这对于低端设备来说会是一个问题,但我对HTC Andriod设备有点惊讶。 Also to help isolate the issue I would test with a normal submit button ie one without runat="server" and see what happens then 另外为了帮助隔离问题,我将使用正常的提交按钮测试,即没有runat="server"按钮,然后看看会发生什么

Also you could try subverting your button and putting in some custom javascript to submit ie 你也可以尝试颠覆你的按钮并输入一些自定义的javascript来提交ie

OnClientClick="formname.submit();"

This link has some similar problems but with autosubmitting drop down lists 链接有一些类似的问题,但有自动提交下拉列表

It's also dimly possible that the swollen ViewState is causing issues with the page size on postback. 肿胀的ViewState也很可能导致回发时页面大小出现问题。 Generally if/when I have been developing for mobile I would turn this off if possible. 一般情况下,如果我一直在开发移动设备,我会尽可能将其关闭。 The resulting page will be larger (a lot larger) than it needs to be. 生成的页面将比它需要的更大(更大)。 If nothing else you would need to make every effort to keep the pages as small as possible (IMHO) 如果没有别的,你需要尽一切努力使页面保持尽可能小(恕我直言)

I'm assuming that you are locked into webforms development at this point -so you could look at ASP.Net mobile controls to see if they behave better - there is a form control in there. 我假设你现在已经被锁定在webforms开发中了 - 所以你可以看一下ASP.Net移动控件 ,看它们是否表现得更好 - 那里有一个表单控件。 But I have never used them or ever seen them used. 但我从来没有使用它们或曾经见过它们。 Some other posters may have had great success with them though? 其他一些海报虽然可能取得了巨大的成功? Perhaps? 也许?

Not helpful but when we developed for mobile we used MVC which is at least more transparent in these kind of situations 没有用,但是当我们为移动设备开发时,我们使用的MVC在这种情况下至少更加透明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM