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

Wight of field in GridBoundColumn

3 Answers 54 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Bertrand Dessaintes
Top achievements
Rank 1
Bertrand Dessaintes asked on 05 Feb 2009, 09:47 AM
Hello, is it possible to change the width of edit text field in GridBoundColumn under make a templatecolumn ?

Thx you

3 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 05 Feb 2009, 10:24 AM
Hello Bertrand,

To change the width of a boundcolumn textbox when the grid is in EditMode( using EditFrom), you can try the following code:
aspx:
 <telerik:GridBoundColumn DataField="ProductName" HeaderText="Product Name" UniqueName="ProductName" > 
 </telerik:GridBoundColumn> 
       

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

Thanks
Princy.
0
Bertrand Dessaintes
Top achievements
Rank 1
answered on 05 Feb 2009, 11:56 AM
Thank you but you have no this possibility in properties in the control GridDatabound ?

Thk you.
0
Princy
Top achievements
Rank 2
answered on 06 Feb 2009, 05:17 AM
Hi Bertrand,

It is not possible to set the width of the edit mode BoundColumn TextBox directly on the aspx. But you can set the custom style editors for columns declaratively by setting the ColumnEditorID property of the corresponding column to the ID of the custom column editor. For more information on this, refer to the following help document:
Declarative style editors

Thanks
Princy.
Tags
Grid
Asked by
Bertrand Dessaintes
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Bertrand Dessaintes
Top achievements
Rank 1
Share this question
or