Non "mobile" controls on Mobile ASPX

Discussion in 'ASP .Net' started by Guest, Aug 17, 2007.

  1. Guest

    Guest Guest

    Hi. I have Mobile site that I'm building. My problem is that all of my pages
    are built as Mobile ASPX pages, but occasionally, I need to use controls
    which are not mobile. Most specifically, the "FileUpload" control. Now, most
    phones don't support this feature, but some do and for them I need to place
    and use this control. How can I insert a FileUpload control on a Mobile ASPX?

    Guest, Aug 17, 2007
    1. Advertisements

  2. Hi Alex,

    Regarding on the non-mobile controls(ASP.NET standard controls), they
    should be used in sepefic DeviceSpecifc template. So if your mobile
    application's target client support HTML, you can define a certain
    deviceSpecific/choice template for it.e.g.

    the following "IsIE" template use those ASP.NET standard controls while
    "IsNotIE" use mobile controls:
    <html xmlns="" >
    <mobile:Form id="Form1" runat="server">

    <mobile:DeviceSpecific ID="dshtml" Runat="server">
    <Choice Filter="IsIE"
    <asp:Label ID="Label2" runat="server" Text="Label"></asp:Label>
    <hr />
    <asp:FileUpload ID="FileUpload1" runat="server" />
    <asp:Button ID="Button1" runat="server" Text="Button" />
    <hr />

    <Choice Filter="IsNotIE">
    <mobile:Label ID="Label1"
    <mobile:TextBox ID="TextBox1" Runat="server">
    <mobile:Command ID="Command1"


    BTW, I have also posted some information about configure and use
    deviceSpecific template in ASP.NET mobile page in your another thread below:

    Subject: Non "mobile" controls on Mobile ASPX
    Newsgroups: microsoft.public.dotnet.framework.aspnet

    Please also feel free to have a look there.


    Steven Cheng

    Microsoft MSDN Online Support Lead


    Get notification to my posts through email? Please refer to

    Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
    where an initial response from the community or a Microsoft Support
    Engineer within 1 business day is acceptable. Please note that each follow
    up response may take approximately 2 business days as the support
    professional working with you may need further investigation to reach the
    most efficient resolution. The offering is not appropriate for situations
    that require urgent, real-time or phone-based interactions or complex
    project analysis and dump analysis issues. Issues of this nature are best
    handled working with a dedicated Microsoft Support Engineer by contacting
    Microsoft Customer Support Services (CSS) at


    This posting is provided "AS IS" with no warranties, and confers no rights.
    Steven Cheng[MSFT], Aug 17, 2007
    1. Advertisements

  3. Guest

    Guest Guest

    Steven -

    As always, thanks so much for your help. But I have to admit, on this I am a
    little lost. I've tried to understand the SeviceSpecific business from the
    documentation and it's very confusing...

    In your sample here, you have a <choice filer="IsIE"...> but I don't really
    know what that means. On a phone, it will only be "IE" if it's a Microaoft
    phone. But there are others that support enough of the features I need. Is
    there a way that I can just place the controls that I need on the page, even
    without having different markup for different devices? I really don't
    understand the way this selection of <choice>'s works. Where are these things
    defined? Can't I just have one template that will be open for using standard

    Guest, Aug 17, 2007
  4. Thanks for your reply Alex,

    For the "DeviceSpecifc" template, I've mentioned your another thread
    "Mobile Repeater..." as I've provided some reference on how to configure
    and define mobile device specific filter there. Anyway, I'll repaste them
    here and add some further description here.

    Actually, for "DeviceSpecific", it can be defined once in each ASP.NET
    mobile control(mobile:Form or other control that support such a template).
    And in each "DeviceSpecific" template, you can add multiple "<Choice>" and
    "choice" is based on a filter, this is configurable in the web.config file.


    <filter name="IsIE" type="ClassLibrary1.MobileFilterClass,
    ClassLibrary1" method="IsIE" />
    <filter name="IsNotIE" type="ClassLibrary1.MobileFilterClass,
    ClassLibrary1" method="IsNotIE" />

    <!-- built-in ones-->
    <filter name="isJPhone" compare="Type" argument="J-Phone" />
    <filter name="isHTML32" compare="PreferredRenderingType"
    argument="html32" />
    <filter name="isWML11" compare="PreferredRenderingType"
    argument="wml11" />
    <filter name="isCHTML10" compare="PreferredRenderingType"
    argument="chtml10" />
    <filter name="isGoAmerica" compare="Browser" argument="Go.Web"
    <filter name="isMME" compare="Browser" argument="Microsoft
    Mobile Explorer" />
    <filter name="isMyPalm" compare="Browser" argument="MyPalm" />
    <filter name="isPocketIE" compare="Browser" argument="Pocket
    IE" />
    <filter name="isUP3x" compare="Type" argument=" 3.x
    Browser" />

    In the "built-in ones" are added when you create a mobile web.config file.
    And the "IsIE" and "IsNotIE" ones are added by myself. I use a custom class
    to supply the filter's detection logic, the code of the class is quite
    simple(just for test):

    public class MobileFilterClass
    public static bool IsIE(System.Web.Mobile.MobileCapabilities
    String compareArgument)
    return true;

    public static bool IsNotIE(System.Web.Mobile.MobileCapabilities
    String compareArgument)
    return false;

    and I can then use it in my mobile page(make sure to add the reference of
    the custom class's assembly in the application):

    =======mobile aspx page=======

    <mobile:Form id="Form1" runat="server">

    <mobile:DeviceSpecific ID="dshtml" Runat="server">
    <Choice Filter="IsIE" >
    <asp:Label ID="Label2" runat="server" Text="Label"></asp:Label>
    <hr />


    as the document mentioned, you can use both class or mobile capability
    properties to define filter:


    #filter Element for deviceFilters (ASP.NET Settings Schema)

    In addition, here are some other MSDN reference helpful to you:

    #Using Device Filters

    #<Choice> Element (.NET Framework Developer's Guide )

    #Device-Specific Content

    Hope this helps a little further on this. If you have any more specific
    questions, welcome to post here.


    Steven Cheng

    Microsoft MSDN Online Support Lead

    This posting is provided "AS IS" with no warranties, and confers no rights.
    Steven Cheng[MSFT], Aug 20, 2007
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.