1. What is .NET Mobile Images control. Explain with an example?

Various mobile devices have different displaying capabilities. The Image control enables developers to specify different types of images fir different devices.

Example: Devices which display GIF, some devices which display BMP or WBMP images.

<%@ Page Inherits= "System.Web.UI.MobileControls.MobilePage"%>

<%@ Register TagPrefix="Mobile" Namespace="System.Web.UI.MobileControls" Assembly="System.Web.Mobile" %>

<Mobile:Form runat="server">
<Mobile:Image runat="server">
<DeviceSpecific>
<Choice ImageURL="image1.gif" />
<Choice ImageURL="image1.bmp" />
<Choice ImageURL="image1.wbmp" />
</DeviceSpecific>
</Mobile:Image>
</Mobile:Form>

2. Do you know TextBox and TextView controls of .NET Mobile?

The textbox control in .NET mobile application is used to display a single line of text, whereas, a textview control is used to display multiple lines of text. The text property of the textview control also accepts HTML tags to specify formatting of the text inside the control.

3. What is .NET Mobile Input Validation. Explain with an example?

Validation controls are used to validate an input control. They provide a message if the validation fails on the control. By default validation is applied on the command event of an input control. One can disable this by setting the input control’s causes validation property to false.

Example:

<%@ Page Inherits= "System.Web.UI.MobileControls.MobilePage"%>
<%@ Register TagPrefix="Mobile" Namespace="System.Web.UI.MobileControls" Assembly="System.Web.Mobile" %>

<script runat="server">

private void Page2(Object Sender, EventArgs e)
{
If (Page.IsValid)
{
ActiveForm=f2;
text2.Text="You are " + age.text + " years old";
}
}

</script>

<Mobile:Form id="f1" runat="server">
<Mobile:CompareValidator runat="server" ControlToValidate="txtage" Type="Integer" ValueToCompare="12" Operator="GreaterThanEqual"> You must be at least 12</Mobile:CompareValidator>

<Mobile:Label runat="server">What is your Age?</Mobile:Label>
<Mobile:TextBox id="txtage" runat="server" />
<Mobile:Command OnClick="Page2" runat="server">Submit</Mobile:Command>
</Mobile:Form>

<Mobile:Form id="f2" runat="server">
<Mobile:Label id="text2" runat="server" />
</Mobile:Form>

This will display a message if the user input is less than 12

4. What is .NET Mobile Utility Controls. Explain with an example?

.NET mobile has a variety of utility complex controls:

AdRotator: A control which displays different images one by one.
Calendar: Standard calendar control for mobile devices.
PhoneCall: Selects the number displayed and calls that number.

Example: Displays text Mike’s Number, and dial the number (91) 1111-111 when the user selects the text.

<%@ Page Inherits= "System.Web.UI.MobileControls.MobilePage"%>
<%@ Register TagPrefix="Mobile" Namespace="System.Web.UI.MobileControls" Assembly="System.Web.Mobile" %>

<Mobile:Form runat="server">
<Mobile:PhoneCall runat="server" PhoneNumber="(91) 1111-111" Text="Mike's number" AlternateFormat="{0}" />
</Mobile:Form>

5. What is password attribute of the textbox control of .NET Mobile?

When the password attribute of the textbox is set to true, it acts as a password input box displaying only stars(*).

6. What is .NET Mobile Lists. Explain with an example?

There are 2 types of lists:

The selectionlist control supports drop down lists, check boxes and also radio buttons.
The list control supports selection from a list or menu. It has a display and a value property.

Example: Display price of a car selected by user.

<script runat="server">

private void Show_Price(Object sender, ListCommandEventArgs e)
{
text1.Text=e.ListItem.Text + "=" + e.ListItem.Value;
ActiveForm=f2;
}
</script>

<Mobile:Form id="f1" runat="server">
<Mobile:List runat="server" OnItemCommand="Show_PriceList">
<Item text="Camry" value="$25,000" />
<Item text="Audi" value="$32,000" />
<Item text="BMW" value="$54,000" />
</Mobile:List>
</Mobile:Form>

<Mobile:Form id="f2" runat="server">
<Mobile:Label runat="server" id="text1" />
</Mobile:Form>

7. What is the numeric attribute of the textbox control in .NET Mobile?

When the numeric attribute of the textbox is set to true it accepts numeric numbers only. However, this behavior can only be observed in mobile devices and not standard web browsers

8. Explain .NET Mobile Input controls?

.NET provides a variety of input controls to enable interaction form the user:

Numeric input: The textbox has a numeric attribute which if set to true accepts only numeric values.
Password input: The textbox has a password attribute which when set to false displays stars(*) in the textbox as the user types in value

9. What are .NET Mobile controls features?

.NET mobile controls features:

Build web pages for many types of mobile devices instead of targeting specific ones.
Allow creation of user controls with events
Offer same features as ASP.NET Pages and server controls along with support to work with multiple devices.
Allow customizing the output for a specific device by adding a new adapter for the control.
Can create new controls which can use inheritance or composition.
Allow adding support for an entirely new device by using adapter extensibility with no changes to individual applications.

10. Can you explain <Mobile:Link> element .NET Mobile with example?

The <Mobile:Link> element enables a user to navigate between 2 forms in a page. Eg:

<%@ Page Inherits= "System.Web.UI.MobileControls.MobilePage"%>
<%@ Register TagPrefix="Mobile" Namespace="System.Web.UI.MobileControls" Assembly="System.Web.Mobile" %>

<Mobile:Form id="form1" runat="server">
<Mobile:Label runat="server">Hello World1
</Mobile:Label>
<Mobile:Link runat="server" NavigateURL="#form2">Form2
</Mobile:Link>
</Mobile:Form>

<Mobile:Form id="form2" runat="server">
<Mobile:Label runat="server">Hello World2
</Mobile:Label>
<Mobile:Link runat="server" NavigateURL="#form1">Form1
</Mobile:Link>
</Mobile:Form>

Download Interview PDF