ComponentOne Input for ASP.NET WebForms
Task-Based Help / C1InputMask Tasks / Hiding the Prompt Character on Leave
In This Topic
    Hiding the Prompt Character on Leave
    In This Topic

    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:

    To write code in Source View

    <cc1:C1InputMask ID="C1InputMask1" runat="server" 
    Mask="(999) 000-0000"
    PromptChar="#"
    HidePromptOnLeave="True">
    </cc1:C1InputMask>

    To hide the prompt character on leave using code:

    To hide the prompt character on leave for the C1InputMask 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:

      To write code in Visual Basic

      Visual Basic
      Copy Code
      With C1InputMask1
          .MaskFormat = "(999) 000-0000"
          .PromptChar = "#"
          .HidePromptOnLeave = True
      End With
      

      To write code in C#

      C#
      Copy Code
      this.C1InputMask1.MaskFormat = "(999) 000-0000";
      this.C1InputMask1.PromptChar = char.Parse("#");
      this.C1InputMask1.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.