Describe .NET Mobile Input controls.
Input controls:- It is used to collect input from the mobile user.
TextBox control:- It is a most common input control.
- TextBox control is perfect for simple user input like names, numbers, identification and keywords.
TextView control:- It is used for larger amounts of input.
- It allows long multi-line input like the one you need for SMS or other messages.
- .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 or false specifies whether the TextBox should accept only numeric values.
Password input:- The TextBox has a password attribute which, when set to true or false it specifies that the textbox should be treated as a password field.
- It will be hide the input by displaying stars(*) in the TextBox as the user types in the textbox field.
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.