RadTextbox changing to ReadOnly ServerSide

2 posts, 0 answers
  1. Annette
    Annette avatar
    16 posts
    Member since:
    Dec 2010

    Posted 24 Feb 2012 Link to this post

    I'm trying to change the RadTextBoxes to readonly but it's not taking the change.

    ((Telerik.Web.UI.RadTextBox)uiControl).ReadOnly = true;

    I have this in the page load event
  2. jumpstart
    jumpstart avatar
    479 posts
    Member since:
    Nov 2011

    Posted 27 Feb 2012 Link to this post


    I am able to set RadTextBox1.ReadOnly = true; in the Page_Load event with no issues.

            <telerik:RadTextBox ID="RadTextBox1" Runat="server" EmptyMessage="- Enter your name -"
                Label="Name:" SelectionOnFocus="CaretToEnd" Skin="Default" ToolTip="Name to which item should be
    shipped." width="161px">
    using Telerik.Web.UI;
    public partial class Default : System.Web.UI.Page
        protected void Page_Load(object sender, EventArgs e)
            RadTextBox1.ReadOnly = true;

    You also have the option to set the RadTextBox to read only status on the client-side using JavaScript:

    <script type="text/javascript"
    function setReadOnly() 
        var TextBox1 = $find("<%= RadTextBox1.ClientID %>"); 
        TextBox1._textBoxElement.readOnly = true
    Hope this helps!
  3. DevCraft R3 2016 release webinar banner
Back to Top