简体   繁体   中英

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. 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. The postbacks simply freeze the page and after some time "Web page not available" is displayed. Even for simple cancel buttons that only have Response.Redirect associated with them.

Has anyone witnessed similar situation? Any ideas on what can cause this? I am using .NET 3.5.

The postbacks work through inserted JavaScript (__doSubmit ). Mobile devices have patchy support for JavaScript. Is it possible to look at the device capabilities for instance by hooking into a WURFL database and look at the device capabilities. I could well imagine that this would be a problem for lower end devices but I am a bit surprised about HTC Andriod devices. Also to help isolate the issue I would test with a normal submit button ie one without runat="server" and see what happens then

Also you could try subverting your button and putting in some custom javascript to submit 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. 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. 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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