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

Radtextbox Readonly

1 Answer 183 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Savyo
Top achievements
Rank 1
Savyo asked on 26 Jul 2012, 07:25 AM
Hi there,
     I have a radgrid edit form with web user control . The usercontrol have a radtextbox in it. How can I make it readonly when editing the grid?
Savyo

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 26 Jul 2012, 07:27 AM
Hi Savyo,

Please try the following code snippet to make the RadTextBox ReadOnly in edit mode.

C#:
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
{
 if (e.Item is GridEditFormItem && e.Item.IsInEditMode)
 {
   GridEditFormItem item = (GridEditFormItem)e.Item;
   UserControl userControl = (UserControl)e.Item.FindControl(GridEditFormItem.EditFormUserControlID);
   RadTextBox txt = (RadTextBox)userControl.FindControl("RadTextBox1"); //access RadTextBox here
   txt.ReadOnly = true;
 }
}

Thanks,
Shinu.
Tags
Grid
Asked by
Savyo
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or