Styling of automatically created edit fields

2 posts, 1 answers
  1. EmpowerIT
    EmpowerIT avatar
    117 posts
    Member since:
    Jun 2007

    Posted 26 Jan 2009 Link to this post

    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.
  2. Answer
    Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 27 Jan 2009 Link to this post

    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
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top