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

RadGrid width autogrow

3 Answers 110 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Santi
Top achievements
Rank 1
Santi asked on 20 Apr 2015, 10:08 AM

Hello, i have a radgrid which i need to show a horizontal scroll when we add a lot of columns and persist the width of the columns but my grid is fxed to the width window and not show the scroll, then resize the width column and this make looks very bad. I put the e.column width in the column_created event with percentage unit.

 I have the width column in a parameter and i put it in the column created event but i dont have width  configured in the radgrid . Is better put it in pixels? i have a column with no size for autogrow with the extra width that other columns not use.

 

Any idea?

 

 

3 Answers, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 22 Apr 2015, 08:58 PM
Hi,

In order horizontal scroll to appear the total width of the columns should exceed the grid width. Try setting column width in px as shown below and see if it helps:

protected void RadGrid1_PreRender(object sender, EventArgs e)
{
    RadGrid1.MasterTableView.GetColumn("ID").HeaderStyle.Width = Unit.Pixel(120);
}

Regards,
Pavlina
Telerik
 

See What's Next in App Development. Register for TelerikNEXT.

 
0
Santi
Top achievements
Rank 1
answered on 23 Apr 2015, 06:40 AM
Yes but i'm now usinf percentage unit and details table views with the expand columns. How can i set the width of this columns?
0
Pavlina
Telerik team
answered on 24 Apr 2015, 08:41 AM
Hello,

You can try changing the ExpandColumn width as shown below:
protected void RadGrid1_PreRender(object sender, EventArgs e)
    {
        foreach (GridColumn column in RadGrid1.MasterTableView.RenderColumns)
        {
            if (column.ColumnType == "GridExpandColumn")
            {
                column.HeaderStyle.Width = Unit.Pixel(10);
            }
        }
    }

Regards,
Pavlina
Telerik
 

See What's Next in App Development. Register for TelerikNEXT.

 
Tags
Grid
Asked by
Santi
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Santi
Top achievements
Rank 1
Share this question
or