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

Styling of automatically created edit fields

1 Answer 32 Views
Grid
This is a migrated thread and some comments may be shown as answers.
EmpowerIT
Top achievements
Rank 2
EmpowerIT asked on 27 Jan 2009, 04:23 AM
Is it possible to specify styles on the automatically created edit fields?

For example I have a string column that I would like to be 500px wide. Is there a way to do that without having to create a gridtemplate column?

I'd only want that one particular column to be that width, and not all other text fields in the grid.

1 Answer, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 27 Jan 2009, 10:49 AM
Hi,

You can achieve this in the ItemDataBound event of RadGrid.

CS:
 protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) 
    { 
        if ((e.Item is GridEditableItem) && (e.Item.IsInEditMode)) 
        { 
            GridEditableItem editItem = (GridEditableItem)e.Item; 
            TextBox txtbx = (TextBox)editItem["columnUniqueName"].Controls[0]; 
            txtbx.Width = Unit.Pixel(500); 
        } 
   } 

You can also have a look at the following demo which explains how to style edited rows.
Styling edited rows

Regards
Shinu
Tags
Grid
Asked by
EmpowerIT
Top achievements
Rank 2
Answers by
Shinu
Top achievements
Rank 2
Share this question
or