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

[Solved] RadGrid AutoGenerated columns issue with HorizontalAlign property

2 Answers 165 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Steven
Top achievements
Rank 1
Steven asked on 02 Apr 2013, 04:55 PM
I have a hierarchy RadGrid implementation which uses the AutoGenerateColumns pattern. In the RadGrid1_ColumnCreated event I'm setting the properties to align specific columns based on a list of column names which require right alignment.

 if (e.Column is GridBoundColumn)
            {
                GridBoundColumn boundColumn = e.Column as GridBoundColumn;

if (RightAlignColumnList.Contains(e.Column.UniqueName))
                {
boundColumn.HeaderStyle.HorizontalAlign = HorizontalAlign.Right;
boundColumn.ItemStyle.HorizontalAlign = HorizontalAlign.Right;
boundColumn.DataFormatString = "{0:N0}";
boundColumn.HeaderStyle.Wrap = true;
boundColumn.ItemStyle.Wrap = true;
}
else
{
boundColumn.HeaderStyle.HorizontalAlign = HorizontalAlign.Left;
boundColumn.ItemStyle.HorizontalAlign = HorizontalAlign.Left;
}

}

The issue is when the grid is rendered the right aligned columns are overflowing the column width - see the MV Base column and the text only displays correctly when I click on the row. Attached is a screenshot of the issue showing 2 rows in the Details section. This behaviour is in IE8 - our company standard browser.

2 Answers, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 05 Apr 2013, 04:35 PM
Hello Steven,

Did you try setting fixed widths to the columns through HeaderStyle.Width?  You can also download the latest version of RadControls(2013.1.403) and see it makes any difference.

If this not helps please provide a live url which we can inspect locally and we will get back to you with additional information.

Regards,
Pavlina
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Steven
Top achievements
Rank 1
answered on 08 Apr 2013, 12:58 PM
Hi Pavlina,

Thank you for the response. The issue is caused by the AllowScroll and UseStaticHeaders combination - this setting combination works fine.
<ClientSettings ReorderColumnsOnClient="false"
        ClientEvents-OnHierarchyExpanding="HierarchyExpanding" 
   ClientEvents-OnGroupExpanded="HierarchyExpanded">
    <Selecting AllowRowSelect="True" />
    <Scrolling AllowScroll="false" UseStaticHeaders="true" ScrollHeight="550px" />
</ClientSettings>

The combination below renders with the issue as described. Of course, this means that scrolling is not available. I'll post a page that you can use to investigate further but for now I can manage without the scrolling option.

<ClientSettings ReorderColumnsOnClient="false"
        ClientEvents-OnHierarchyExpanding="HierarchyExpanding" 
   ClientEvents-OnGroupExpanded="HierarchyExpanded">
    <Selecting AllowRowSelect="True" />
    <Scrolling AllowScroll="true" UseStaticHeaders="true" ScrollHeight="550px" />
</ClientSettings>
Tags
Grid
Asked by
Steven
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Steven
Top achievements
Rank 1
Share this question
or