Is it possible to hide the mask?

4 posts, 0 answers
  1. Karl
    Karl avatar
    8 posts
    Member since:
    Apr 2011

    Posted 28 Apr 2011 Link to this post

    I would like the input to originally appear empty, and only show the mask if the user begins entering a value.  If the user removes the value, the mask will again disappear.

    Is this functionality possible with this control?
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 29 Apr 2011 Link to this post


    You can achieve this behavior by setting the HideOnBlur  property of the RadMaskedTextBox to "True"
    Here is a sample code:

    <telerik:RadMaskedTextBox ID="RadMaskedTextBox1" runat="server" HideOnBlur="True" Mask="(###) ###-####">

  3. Vincent
    Vincent  avatar
    3 posts
    Member since:
    Oct 2011

    Posted 28 Aug 2012 Link to this post

    This function HideOnblur does not work when I have a RequiredFieldValidator attached to the RadMaskedTextBox. It always display the mask. Is there a work around?
  4. Vasil
    Vasil avatar
    1604 posts

    Posted 29 Aug 2012 Link to this post

    Hello Vincent,

    The Validator itself does not affect the behaviour of RadMaskedTextBox and its HideOnBlur property.

    It is possible that you have set SetFocusOnError="true" for your Validator, in this case when you try to blur, the validator gets back the focus to the input element of RadMaskedTextBox, and since the input is in focus, it will again display the mask.
    Make sure you have set SetFocusOnError="false" for your Validator to avoid this problem.

    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top