ARTICLE

Advanced Controls of Mobile Internet in VB.NET

Posted by Manish Tewatia Articles | Mobile Dev in VB.NET October 07, 2010
In this article I will explain you about Advanced Controls of Mobile Internet in VB.NET.
 
Reader Level:

TextView

At some point you may find the need to display an arbitrary amount of text and even some markup tags. The TextView control takes care of this for you. To handle large amounts of text, a form's Pagination property may come in handy. What is Pagination? There are many times when the size of a client's screen is unknown. Using the Pagination property allows a developer to partition the display of data across a number of pages. The TextView control supports both custom and internal pagination. You turn on pagination by setting the form's Pagination property to true.

<
mobile:textview runat="server" id="TextView1" alignment="Center" forecolor="Blue"
    font-bold="true">

This is the basic entry gateway
for Mobile Programming!!!! Have Fun

</
mobile:textview>


Link:
The Link control creates a hyperlink in a mobile form. When the user invokes the Link control, a browser traverses to the URL provided in the NavigateURL property.


<
mobile:link runat="server" id="Link1" text="Goto Link" navigateurl="#Form1">
</
mobile:link>


If the NavigateURL property's value begins with a number sign (#), the browser searches the current mobile page for a form tag with the corresponding ID. Otherwise it is assumed to be a valid URL.

Image: Graphics can be an important part of any application, and that includes wireless devices. The Image control displays images, which the developer specifies by setting the ImageURL property. It also has a NavigateURL property, which adds a clickable area to the image, allowing a client to navigate to another destination.


<
mobile:image runat="server" id="image1" alternatetext="Image is unvisible" imageurl="image1.gif">
</
mobile:image>


List:
The List control provides you with the power to show a list of items in a static as well as an interactive manner. This is an important control if you want to provide the user with choices or if you want to bind data to a control.


<
mobile:list runat="server" id="List1" onitemcommand="List1_Click">
<
item Text="Shivani" Value="Shivani"/>
<
item Text="Shilpa" Value="Shilpa"/>
</
mobile:list>


An example of advanced user controls is shown in Listing 24.4.

Listing 24.4: Example of Advanced UI Controls


<%
@ Page Inherits="System.Web.UI.MobileControls.MobilePage" Language="vb" %>
<%
@ Register TagPrefix="mobile" Namespace="System.Web.UI.MobileControls" Assembly="System.Web.Mobile" %>
<
script language="vb" runat="server">
   
Public Sub List1_Click(ByVal source As [Object], ByVal e As ListCommandEventArgs)
        Label1.Text = "Hi " & Convert.ToString(e.ListItem.Text)
        ActiveForm = Form2
    End Sub

</
script>
<
mobile:form id="Form1" runat="server" backcolor="Blue">
<
mobile:TextView runat="server" id="TextView1">

Here you are going to select one Name!!

</
mobile:TextView>
<
mobile:List runat="server" id="List1" OnItemCommand="List1_Click">
<
item Text="Shivani" Value="Shivani" />
<
item Text="Shilpa" Value="Shilpa" />
</
mobile:List>
</
mobile:form>
<
mobile:form id="Form2" runat="server">
<
mobile:Label id="Label1" runat="server"/>
<
mobile:Image runat="server" id="Image1" ImageURL="Congrats.wbmp"
AlternateText
="Hey no Image for you">
</
mobile:Image>
</
mobile:form>


The output of the code in Listing 24.4 is shown in Figures 24.5 and 24.6.

Figure 24.5: Screen Displaying a List of Names with a Link

Figure-24.5.gif

Figure 24.6: Screen Showing Selected Output from the List

Figure-24.6.gif

Here is an important point to note. In the example, the ImageURL is in the .wbmp format. The image format supported on WAP devices is wbmp format. These images tend to be small and relatively simple, given the constraint of the devices' size. Thus, those devices that do not support the .wbmp format would display the AlternateText value rather than the image. For this problem we have the DeviceSpecific class, which gives you the power to provide the specific content. The following example shows how to use device-specific content:

<
DeviceSpecific>
<
Choice Filter="IsHtml" ImageURL="Congrats.gif"/>
<
Choice Filter="IsWbmp" ImageURL="Congrats.wbmp"/>
<
Choice ImageURL="Congrats.bmp"/>
</
DeviceSpecific>


The DeviceSpecific class affords a means to specify device-dependent content. If a device supports a .gif image, then the Congrats.gif will be displayed, while devices supporting an image/vnd.wap.wbmp will output Congrats.wbmp. The default behavior will display the Congrats.bmp.

Conclusion

Hope this article would have helped you in understanding Advanced Controls of Mobile Internet in VB.NET.

Login to add your contents and source code to this article
share this article :
post comment
 
Become a Sponsor
PREMIUM SPONSORS
  • Finally – a virtual platform that delivers next-generation Windows Server 2008 Hyper-V virtualization technology from a managed hosting partner you can truly depend on. Visit www.maximumasp.com/max for a FREE 30 day trial. Hurry offer ends soon. Climb aboard the MaxV platform and take advantage of High Availability, Intelligent Monitoring, Recurrent Backups, and Scalability – with no hassle or hidden fees. As a managed hosting partner focused solely on Microsoft technologies since 2000, MaximumASP is uniquely qualified to provide the superior support that our business is built on. Unparalleled expertise with Microsoft technologies lead to working directly with Microsoft as first to offer IIS 7 and SQL 2008 betas in a hosted environment; partnering in the Go Live Program for Hyper-V; and product co-launches built on WS 2008 with Hyper-V technology.
    The leading .NET charting control now features PDF, Flash and Silverlight export, visualization of large datasets and more. Deliver true charting functionality to your BI, Scorecard, Presentation or Scientific apps. Download evaluation now.
Nevron Diagram
Become a Sponsor