开发者

UIWebview and IPhone content does not postback (ASP.NET Browser Capability issues)

I have a simple page, it's structure is as follows (pseudo code) :

<aspx page>
    <ascx control>
        <asp:dropdownlist id="dd1" autoPostback=true />
        <asp:dropdownlist id="dd2" />
    </ascx control>
</aspx page>

In ANY desktop browser, dd1 posts back and the "SelectedIndexChanged" server event is fired. However in the IPhone safari or an IPhone webview, no postback is done. I know this because no network activity indicator is shown and I've hooked a debugger to the site that catches all serverside events and it is never hit. Sometimes, about once every 2 hours, the postback DOES work on the iphone, but extremely rarely and inter开发者_开发百科mittently.

Dd1 is a date dropdown that loads a time slot drop down that is dependent on the selected item in the date dropdown. This form is re-used in many places and I don't want to change the basic structure unless it's a last ditch effort.

Javascript is enabled in safari settings.

Simple enough right? I'm trying to figure out how to debug javascript errors on a webview, but I was wondering if anyone knew what oddity it was that created this behavior.


The user agent of the IPhones UIWebView was not recognized by ASP.NET 4.0, so asp.net served up as a default, the Downlevel version of the page which included no javascript. The iphones webview user agent was:

Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_3_5 like Mac OS X; en-us) AppleWebKit/533.17.9 (KHTML, like Gecko) Mobile/8L1

To avoid that happening I changed the "ClientTarget" property of the page to "UpLevel" which bypasses asp.net trying to figure out the browser capabilities and just serves up an "Uplevel" version javascript and all.

Solution in my Page's Page_Load:

Me.ClientTarget = "uplevel"

or

this.ClientTarget = "uplevel";

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜