ComponentOne Input for ASP.NET AJAX: Input for ASP.NET AJAX Task-Based Help > C1MaskedInput Tasks > Hiding the Prompt Character on Leave

Hiding the Prompt Character on Leave

You can set the HidePromptOnLeave property to True to hide the prompt characters when the control loses input focus.

To hide the prompt character on leave using .html markup:

In the markup of the .aspx page insert:

 

<cc1:C1MaskedInput ID="C1MaskedInput1" runat="server"

Mask="(999) 000-0000"

PromptChar="#"

HidePromptOnLeave="True">

</cc1:C1MaskedInput>

To hide the prompt character on leave using code:

To hide the prompt character on leave for the C1MaskedInput control

1.   Double-click the Web page to create an event handler for the Load event.

2.   Enter the following code for the Page_Load event:

      Visual Basic

With C1MaskedInput1

    .Mask = "(999) 000-0000"

    .PromptChar = "#"

    .HidePromptOnLeave = True

End With

      C#

this.C1MaskedInput1.Mask = "(999) 000-0000";

this.C1MaskedInput1.PromptChar = char.Parse("#");

this.C1MaskedInput1.HidePromptOnLeave = true;

This topic illustrates the following:

Run the project. Notice that the prompt characters for the phone number mask are hidden:

 

 

When you click inside the input box and it gets focus, the prompt characters (for this example, #) appear:

 

 

When you click outside of the input box and it loses focus, the prompt characters are hidden again. For details on changing the prompt characters, see the Changing the Prompt Character topic.


Send comments about this topic to ComponentOne.
Copyright © 1987-2010 ComponentOne LLC. All rights reserved.