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

    Annette:

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

    Default.aspx:
            <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">
            </telerik:RadTextBox>
     
    Default.aspx.cs:
    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:

    Default.aspx:
    <script type="text/javascript"
    function setReadOnly() 
        var TextBox1 = $find("<%= RadTextBox1.ClientID %>"); 
        TextBox1._textBoxElement.readOnly = true
    </script> 
     
    Hope this helps!
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top