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

Increase or decrease the size of the columns of RadGrid

1 Answer 97 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Syed
Top achievements
Rank 1
Syed asked on 14 May 2009, 06:44 PM
Hi,

I want to increase and decrease the size of columns of RadGrid.

Moreover i need while "Add a new record" and "edit" button is pressed, i see textboxes width is very large and i want to decrease the size.
Thanks.

Regards
Arshad

1 Answer, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 15 May 2009, 04:41 AM
Hello Syed,

You can set the width of columns using the HeaderStyle for the column as shown below:
aspx:
 <telerik:GridBoundColumn DataField="Category" HeaderText="Category"  UniqueName="Category"
        <HeaderStyle Width="30px" /> 
 </telerik:GridBoundColumn> 

Also if you want to set the width of the textboxes in Edit/Insert modes of your grid, you can try out the following code:
c#:
protected void RadGrid1_ItemCreated(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(100);  
        }   
          
    } 

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