Ajax Masked Edit Extender

20 September, 2018

Related Blogs

Masked Edit Extender

This Control is used to provide a mask to the control to restrict it to accept only specific data Properties TargetControlID : Mask Type : Used to specify the type of mask to apply for the target control. This can be Datetime
  • Date
  • None
  • Number
  • Time
Mask :  Used to specify the mask for the target control based on the mask type. Autocomplete : Indicates whether or not the value of target control is automatically completed if user make it incomplete.  

Masked Edit Validate

This control is used to validate the control that is extended with masked edit extender. Properties  Control To Validate :
  • Used to specify the ID of the control to validate using Masked Edit Validator this must be same as TargetCotnrolID of Masked Edit Extender
  • Used to specify the ID of the maskedEditExtender which you are extending with masked edit Validator.
ISvalid Empty :
  • Indicates Whether or not the control to validate will be valid if it is empty.
Invalid Value Message :
  • Used to specify the error Message to display when the value in control to validate is invalid based on Mask set for Masked Edit Extender.
Empty value Message : Used to specify the error message to display when control is empty and this can be set only when is valid empty property is set to false. To specify the mask for the masked Edit Extender control you can use the following  characters. 9      –       Only a numeric character L       -        Only a letter $      -        Only a letter or a space C      -        Only a custom character (case Sensitive) A      -        Only a letter or a custom character N      -        Only a numeric or custom character ?      -        Any Character /       -        Date separator :       -        Time Separator .       -        Decimal Separator ,       -        Thousand Separator \       -        Escape Character {       -        Initial decimal for repetition of masks }       -        Final delimiter for repetition of masks Example The following example demonstrates how to use maskedEditExtender & maskedEditValidator. Add a page to the website and then place a toolkit script manager & a textbox on it and set ID of the Textobx as T1. Within HTML Source of the page drag & drop a masked Edit Extender and set following properties to it make the Textobx T1 accept only Date. <asp: MaskedEditExtender  Id=”MaskedEditExtender” runat=”server” TargetControlID=”T1” MaskType=”Date” Mask=”99/99/9999” Autocomplete=”false”> </asp: Masked Edit Extender> Within HTML Source of the page Drag & Drop a masked Edit Validator and set following properties for it to validate Textbox T1 based on the mask set for maskedEditExtender1 <asp: MaskedEditValidator ID=”MaskedEditValidator1” runat=”server” controlTOValidate = “T1” ControlExtender=”maskedEditExtender1” ISValidEmpty=”true” InvalidvalueMessage=”You must enter date in dd/mm/yyyy format”> </asp:MaskedEditValidator> At runtime when user is providing an Invalidvalue in the textbox t1 then an error message is display with masked Editvalidator.