ARTICLE

MaskedEdit Control in Ajax

Posted by Sapna Articles | ASP.NET AJAX in VB.NET September 21, 2011
MaskedEdit Control is edit field control. We can crate with TextBox control.
 
Reader Level:

Introduction : MaskedEdit Control is edit field control that can be attached to a TextBox control.With the help of this control we create a template of user entry of information such as Number, ID.
MaskedEditValidators Extenders control help user enter the correct data and support more complex rule.

Properties of MaskEdit Control.

  • Mask.
  • MaskType.
  • MessageValidatorTip.
  • UserDateFormate.
  • UserTimeFormate.
  • AutoCompleteValue.
  • Century.
  • PromptChararacter.

Step : 1 Open Visual Studio and go to File menu option.

  • Select WebSite  option.
  • Select ASP.NET Web Site.
ASP-page1.gif
Step : 2
 Go to Solution Explorer and right click.
  • Select Add New Items.
  • Select Web Form.
  • Go to Source menu option.
webforms.gif

Step : 3  Drag and Drop Control in ToolBox.

  • Drag TextBox, MaskedEdit, MaskedEditValidator control.
  • Write a code.

Code :

<title>masked control</title>
</head>
<
body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <div>
        date <asp:TextBox ID="TextBox1" runat="server" Width = "70px" BackColor = "Azure"></asp:TextBox><br />
 <asp:MaskedEditExtender ID="MaskedEditExtender1" runat="server" TargetControlID = "TextBox1" MaskType ="Date"  Mask="99/99/9999" 
ClearTextOnInvalid = "true" PromptCharacter = "_" ></asp:MaskedEditExtender>
       <asp:MaskedEditValidator ID="MaskedEditValidator1" runat="server" ControlExtender = "MaskedEditExtender1" ControlToValidate = "TextBox1" EmptyValueMessage = "required date" ValidationExpression = "valid date" IsValidEmpty = "false" TooltipMessage = "input a data" Display = "None"></asp:MaskedEditValidator>
        </div>
    </form
>
</body>
</
html>
Step : 4  Press F5 and run.

date3.gif
Step : 5 
Now we click on TextBox and write a date.

date1.gif

Login to add your contents and source code to this article
share this article :
post comment
 
Team Foundation Server Hosting
Become a Sponsor
PREMIUM SPONSORS
  • ceTE software specializes in components for dynamic PDF generation and manipulation. The DynamicPDF™ product line allows you to dynamically generate PDF documents, merge PDF documents and new content to existing PDF documents from within your applications.
    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.
6 Months Free & No Setup Fees ASP.NET Hosting!
Become a Sponsor