Interviewer And Interviewee Guide

Microsoft .Net Mobile Interview Question:

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

Submitted by: Administrator
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
Submitted by: Administrator

Read Online Microsoft .Net Mobile Job Interview Questions And Answers
Copyright 2007-2024 by Interview Questions Answers .ORG All Rights Reserved.
https://InterviewQuestionsAnswers.ORG.