Non "mobile" controls on Mobile ASPX

G

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?

Alex
 
S

Steven Cheng[MSFT]

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="http://www.w3.org/1999/xhtml" >
<body>
<mobile:Form id="Form1" runat="server">

<mobile:DeviceSpecific ID="dshtml" Runat="server">
<Choice Filter="IsIE"
Xmlns="http://schemas.microsoft.com/mobile/html32template">
<HeaderTemplate>
<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 />
</HeaderTemplate>
</Choice>


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


</mobile:Form>

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.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead



==================================================

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.



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
http://msdn.microsoft.com/subscriptions/support/default.aspx.

==================================================


This posting is provided "AS IS" with no warranties, and confers no rights.
 
G

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
controls?

Alex
 
S

Steven Cheng[MSFT]

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.
e.g.

==========
<deviceFilters>

<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="Phone.com 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
capabilities,
String compareArgument)
{
return true;
}

public static bool IsNotIE(System.Web.Mobile.MobileCapabilities
capabilities,
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" >
<HeaderTemplate>
<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:

#<deviceFilters>
http://msdn2.microsoft.com/en-us/library/k25f323z.aspx

#filter Element for deviceFilters (ASP.NET Settings Schema)
http://msdn2.microsoft.com/en-us/library/ms228320.aspx

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


#Using Device Filters
https://msdn2.microsoft.com/en-us/library/d7k7a6z2.aspx

#<Choice> Element (.NET Framework Developer's Guide )
http://msdn2.microsoft.com/en-us/library/3tfbhf6f.aspx

#Device-Specific Content
http://dotnetjunkies.com/MobileQuickStart/(klvbrkyhamv2i5yfzqwhhxnr)/Default
..aspx?url=doc/DeviceSpecific.aspx

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

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


This posting is provided "AS IS" with no warranties, and confers no rights.
 

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. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,050
Latest member
AngelS122

Latest Threads

Top