MSDN Magazine - February 2008 - (Page 44) shows the final user interface presented by a textbox extended with a masked editor. The appearance of the currency symbol is controlled by the DisplayMoney property, and each character the user must type is represented by a prompt. The default prompt is the underscore, but you can change it via the PromptCharacter property. For dates, you can also use extra properties such as AcceptAMPM, Century, and even a custom user format in addition to the predefined formats found in the MaskedEditUserDateFormat enumeration, shown here: public enum MaskedEditUserDateFormat { None, DayMonthYear, DayYearMonth, MonthDayYear, MonthYearDay, YearDayMonth, YearMonthDay } through the UICulture attribute in the @ Page directive. Validating the Masked Input While the masked extender provides dynamic formatting capabilities, an additional component—the masked validator—ensures that any text entered can be parsed back to the expected type: Figure 2 Many of the settings that influence the formatting applied by the MaskedEdit extender descend from the current culture. The CultureName property indicates the culture to apply. Note that this setting overrides the culture setting defined for the page The MaskedEditValidator control is a custom validator that you optionally attach to the MaskedEdit extender so that the contents of the edited textbox are carefully verified. The validator ensures that the text matches the mask. It performs server and client validation and can be associated with a validation group, just like any other ASP.NET validator control. The properties exposed by the validator are listed online in Figure B at go.microsoft.com/fwlink/?LinkId=105571. The Text property of a masked textbox returns formatted text. For a date, the property returns something like “02/04/2007”; for a number input field, the property returns text like “1,200.00”. The currency symbol is Advanced Document Imaging Toolkits Our .NET imaging components are designed exclusively for the Microsoft .NET Framework, offering developers Photographic and Document imaging for web and windows based applications featuring AJAX-enabled web imaging, PDF support, data capture, scanning/OCR, barcode reading systems, image management, and archiving. Advanced technology to power your applications. Visit Atalasoft.com for a free trial download. Atalasoft, Your .NET Imaging Partner Call us toll free at 866-568-0129 www.atalasoft.com 44 msdnmagazine Cutting Edge http://go.microsoft.com/fwlink/?LinkId=105571 http://www.atalasoft.com http://Atalasoft.com
For optimal viewing of this digital publication, please enable JavaScript and then refresh the page. If you would like to try to load the digital publication without using Flash Player detection, please click here.