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

Change TextBox properties in edit mode

2 Answers 53 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Bruce
Top achievements
Rank 1
Bruce asked on 25 Mar 2009, 12:11 PM
When a user clicks the "edit" link on a grid row and the fields for the row are displayed as textboxes (for changing the data), how can I access the textbox properties? (to change the font, etc.) 

2 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 25 Mar 2009, 12:41 PM
Hi Bruce,

Try the following code snippet in the ItemDataBound event to access the TextBox in edit mode.

CS:
 
protected void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e) 
    { 
        if((e.Item is GridEditableItem )&&(e.Item.IsInEditMode)) 
        { 
            GridEditableItem editItem = (GridEditableItem)e.Item; 
            TextBox txtbx = (TextBox)editItem["columnUniqueName"].Controls[0]; 
            txtbx.Font.Name = "Garamond"
        } 
    } 


Thanks
Princy.


0
Bruce
Top achievements
Rank 1
answered on 25 Mar 2009, 12:51 PM
Just what I was looking for - Thanks!
Tags
Grid
Asked by
Bruce
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Bruce
Top achievements
Rank 1
Share this question
or