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
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.
This control is used to validate the control that is extended with masked edit extender. Properties Control To Validate :
ControlExtender:
ISvalid Empty :
Invalid Value Message :
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.
You liked the article?
Like: 0
Vote for difficulty
Current difficulty (Avg): Medium
TekSlate is the best online training provider in delivering world-class IT skills to individuals and corporates from all parts of the globe. We are proven experts in accumulating every need of an IT skills upgrade aspirant and have delivered excellent services. We aim to bring you all the essentials to learn and master new technologies in the market with our articles, blogs, and videos. Build your career success with us, enhancing most in-demand skills in the market.