This is a migrated thread and some comments may be shown as answers.

RadTextbox changing to ReadOnly ServerSide

1 Answer 170 Views
Input
This is a migrated thread and some comments may be shown as answers.
Annette
Top achievements
Rank 1
Annette asked on 24 Feb 2012, 04:20 PM
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

1 Answer, 1 is accepted

Sort by
0
Richard
Top achievements
Rank 1
answered on 27 Feb 2012, 10:02 PM
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!
Tags
Input
Asked by
Annette
Top achievements
Rank 1
Answers by
Richard
Top achievements
Rank 1
Share this question
or