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

Set Width on cell in edit mode

1 Answer 25 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Derek
Top achievements
Rank 1
Derek asked on 28 Aug 2008, 04:59 PM
How do you set the width on a cell that is in "edit mode"?  These don't seem to work:                          <HeaderStyle Width="5px" />
                        <ItemStyle Width="5px" />

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 29 Aug 2008, 04:33 AM
Hi Derek,

Try the following code snippet to achieve the desired scenario.

CS:
protected void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e) 
    { 
        
        if ((e.Item is GridEditableItem)&&(e.Item.IsInEditMode)) 
        { 
            GridEditableItem editedItem = (GridEditableItem)e.Item; 
            TableCell cell = editedItem["ColumnUniqueName"]; 
 
            //to set the width of EditFormCelll 
            cell.Width = Unit.Pixel(100); 
 
          // to set the width of the control in EditFormCell 
            TextBox txtbx = (TextBox)cell.Controls[0]; 
            txtbx.Width = Unit.Pixel(50); 
         } 
   } 


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