RadTextBox - Issue with set_enabled(false)

4 posts, 0 answers
  1. Brindavan
    Brindavan avatar
    12 posts
    Member since:
    Feb 2009

    Posted 22 Apr 2009 Link to this post


    I wrote the following code in javascript
    { var controltodisable= $find("<%= ControlToDisable.ClientID %>");

    Here, ControlToDisable is a RadTextBox.
    With the above code the textbox looks disabled but I am still able to type text in it. The text appears greyed out though.

    How can I resolve the issue?

    Also, when I disable the same textbox from clientside (JS) and codebehind (CS) there is a difference in the field display style.
    What could be the issue?


  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 23 Apr 2009 Link to this post

    Hi Brindavan,

    Try using the disable() method in order to disable the RadTextBox from client side.

    <telerik:RadTextBox ID="ControlToDisable" runat="server">  

    <script type="text/javascript">  
    function Disable()  
        var RadTextBox1 = $find("<%= ControlToDisable.ClientID %>");  
    RadTextBox Client Object

  3. DevCraft R3 2016 release webinar banner
  4. Sonia
    Sonia avatar
    90 posts
    Member since:
    Mar 2012

    Posted 05 Nov 2013 Link to this post

    Hi Princy,

    I have tested your solution and the control behaves correctly. However when I come back to the server after clicking on a button, value from the disabled textbox cannot be read.
    I solved that problem by enabling again the RadTextBox control on the OnClientClick method of the button.
    But i was wondering if there is a better way to do that.

  5. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 15 Nov 2013 Link to this post

    Hi Sonia,

    For such scenarios I suggest you set the RadTextBox to ReadOnly instead of disabling the whole control. You can try the following code to make a RadTextBox ReadOnly from client side.

    <script type="text/javascript"
    function setReadOnly() 
        var TextBox1 = $find("<%= RadTextBox1.ClientID %>"); 
        TextBox1._textBoxElement.readOnly = true

    Hope this helps,
Back to Top