I'm using the CSSFriendly.MenuAdapter for all default browsers, but now we would like a different Adapter if the user access the page with an iPhone. I have a basic prototype of the new Adapter, but the problem is that if I had that to my .browser file,
it does not recognize it. For testing, I just use the normal Safari. Here is the file:
The idea is that every browser, BUT Safari would use the Default setting. But Safari is using the Default Setting too. If I remove the Default setting, Safari does use my own Adapter and all other browsers just display the Standard Menu. How do I get this
to work? I've tried a different sequence too.
rblaettler
Participant
1166 Points
317 Posts
Different Adapters for different Browsers
Nov 04, 2008 07:50 PM|LINK
I'm using the CSSFriendly.MenuAdapter for all default browsers, but now we would like a different Adapter if the user access the page with an iPhone. I have a basic prototype of the new Adapter, but the problem is that if I had that to my .browser file, it does not recognize it. For testing, I just use the normal Safari. Here is the file:
<browser refID="Safari">
<controlAdapters>
<adapter controlType="System.Web.UI.WebControls.Menu"
adapterType="Supertext.iUiMenuAdapter" />
</controlAdapters>
</browser>
<browser refID="Default">
<controlAdapters>
<adapter controlType="System.Web.UI.WebControls.Menu"
adapterType="CSSFriendly.MenuAdapter" />
</controlAdapters>
</browser>
The idea is that every browser, BUT Safari would use the Default setting. But Safari is using the Default Setting too. If I remove the Default setting, Safari does use my own Adapter and all other browsers just display the Standard Menu. How do I get this to work? I've tried a different sequence too.
Chief of the System
Supertext AG
rblaettler
Participant
1166 Points
317 Posts
Re: Different Adapters for different Browsers
Nov 11, 2008 10:10 PM|LINK
Never really got a response and couldn't find a solution either. So, please, if you know something, let me know.
What I figured out is how you can just replace the Adapter in your code like this:
protected override void OnPreInit(EventArgs e) { HttpContext.Current.Request.Browser.Adapters["System.Web.UI.WebControls.Menu, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"] = "Supertext.Adapters.iUiMenuAdapter"; base.OnPreInit(e); } protected override void OnUnload(EventArgs e) { base.OnUnload(e); HttpContext.Current.Request.Browser.Adapters["System.Web.UI.WebControls.Menu, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"] = "CSSFriendly.MenuAdapter"; }More on my blog post about this topic. Hope it helps someone.
css adapters adapter ASP.NET
Chief of the System
Supertext AG