Displaying Invalid Input Color
The following topic shows how to use the InvalidInputColor property for the C1MaskedInput control; however, the InvalidInputColor property is available for all Input for ASP.NET AJAX controls.
Using the Designer
To display a color when the user enters improper input, complete the following tasks:
1. Open the C1MaskedInput Tasks menu and click the ellipsis next to the InvalidInputColor property.
2. Select a color that will appear when the user enters improper input. For this example, select Red.
Using HTML Markup
To display a color when the user enters improper input, use the following markup in the .aspx page:
<cc1:C1MaskedInput ID="C1MaskedInput1" runat="server"
Mask="(999) 000-0000"
Text="412"
InvalidInputColor="Red">
</cc1:C1MaskedInput>
Using Code
To display a color when the user enters improper input, double-click the Web page to create an event handler for the Load event. Enter the following code for the Page_Load event
Me.C1MaskedInput1.Mask = "(999) 000-0000"
Me.C1MaskedInput1.Text = "412"
' Set invalid input color
Me.C1MaskedInput1.InvalidInputColor = Drawing.Color.Red
• C#
this.C1MaskedInput1.Mask = "(999) 000-0000";
this.C1MaskedInput1.Text = "412";
// Set invalid input color
this.C1MaskedInput1.InvalidInputColor = Drawing.Color.Red;
This topic illustrates the following:
Run the project and type a non-numeric key, which is invalid, and notice that the control displays red text:
|