How to enable/disable RadMaskedTextBox clientside?

5 posts, 1 answers
  1. Gauri
    Gauri avatar
    32 posts
    Member since:
    Jan 2012

    Posted 02 May 2012 Link to this post

    I need to enable/disable RadMaskedTextBox clientside?

    I will appreciate any help.

    Thanks.
    Gauri
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 03 May 2012 Link to this post

    Hello Gauri,

    Try the following javascript.
    JS:
    function OnClientClick()
    {  
     var txt1 = $find("<%=RadMaskedTextBox1.ClientID %>");
     txt1.set_enabled(false);
    }

    Thanks,
    Shinu.
  3. Gauri
    Gauri avatar
    32 posts
    Member since:
    Jan 2012

    Posted 03 May 2012 Link to this post

    Thanks Shinu,

    But I had already tried this and that didn't do the trick. :(
  4. Answer
    Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 03 May 2012 Link to this post

    Hi Gauri,

    Take a look into the following code snippet.

    JS:
    <script type="text/javascript">
        function OnClientClick()
        {
            var txt1 = $find("<%=RadMaskedTextBox1.ClientID %>");
            if (some condition)
                txt1.enable();
            else
                txt1.disable();
        }
    </script>

    Thanks,
    Shinu.
  5. Gauri
    Gauri avatar
    32 posts
    Member since:
    Jan 2012

    Posted 03 May 2012 Link to this post

    Thanks a lot for the help.

    I tried each one separately before and didn't work.

    Using them together seems to do the trick.
Back to Top