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

grid bound column

1 Answer 95 Views
Grid
This is a migrated thread and some comments may be shown as answers.
sugu j
Top achievements
Rank 1
sugu j asked on 18 May 2010, 11:22 AM
how to make textbox as read only in grid bound column when in edit mode.

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 18 May 2010, 12:53 PM
Hello Sugu,

If you want to make the textbox control in EditForm to uneditable, then you can try the following code snippet for setting the TextBox's ReadOnly property to True.

C#:

 protected
 void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) 
    { 
        if (e.Item is GridEditFormItem && e.Item.IsInEditMode) 
        { 
            GridEditFormItem edititem = (GridEditFormItem)e.Item; 
            TextBox txt = (TextBox)edititem["GridBoundColumn1"].Controls[0]; 
            txt.ReadOnly = true
        } 
    } 

Also setting the ReadOnly property for the columns will make the column not ediatable, but the textbox control will not render in editmode for the particular column.

Regards,
Shinu.
Tags
Grid
Asked by
sugu j
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or