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

RadGrid columns do not follow css rules after drag-n-drop

2 Answers 80 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Matt
Top achievements
Rank 1
Matt asked on 15 Sep 2011, 03:28 AM
Hi,
I am having problems with drag-n-drop columns into group pane, here is the declaration of gird:
<style type="text/css">
    .w130px {width: 130px;}
    .w400px {width: 400px;}
</style>
  
<telerik:RadGrid ID="radGrid" AutoGenerateColumns="false" runat="server" width="100%" ShowGroupPanel="true" DataSourceID="dataSource1">
    <MasterTableView>
        <Columns>
            <telerik:GridBoundColumn DataField="DesktopModuleID" HeaderText="DesktopModuleID" ItemStyle-CssClass="w130px" HeaderStyle-CssClass="w130px"></telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="ModuleName" HeaderText="ModuleName"></telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="Description" HeaderText="Description" ItemStyle-CssClass="w400px" HeaderStyle-CssClass="w400px"></telerik:GridBoundColumn>
        </Columns>
    </MasterTableView>
    <ClientSettings AllowDragToGroup="true">
        <Scrolling AllowScroll="true" UseStaticHeaders="true" />
    </ClientSettings>
</telerik:RadGrid>

I drop a column into the group pane, find the header and item columns not aligned. The header columns still follow css rules, which has 130px, remaining space and 400px, but each item column seems to have 1/3 of table width.

If I remove the Scrolling:UseStaticHeaders, the problems seem to go away, but I need to have data grouping and static header work together. 

Please help

2 Answers, 1 is accepted

Sort by
0
Matt
Top achievements
Rank 1
answered on 20 Sep 2011, 05:18 AM
Hello,
Does anybody has solution or workaround for this? It's frustrating for me to have less than 10 lines of codes not working and need them to work.

Thanks again
0
Veli
Telerik team
answered on 20 Sep 2011, 09:10 AM
Hello Matt,

The recommended approach for setting your column width is through the HeaderStyle-Width property:

<telerik:GridBoundColumn DataField="ID" HeaderText="DesktopModuleID" UniqueName="DesktopModuleID"
    HeaderStyle-Width="130px" />
<telerik:GridBoundColumn DataField="Name" HeaderText="ModuleName" UniqueName="ModuleName" />
<telerik:GridBoundColumn DataField="Name" HeaderText="Description" UniqueName="Description"
        HeaderStyle-Width="400px"/>

This approach uses inline styles to set the column widths and is compatible with column calculations RadGrid performs when you have enabled static headers.

Greetings,
Veli
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
Tags
Grid
Asked by
Matt
Top achievements
Rank 1
Answers by
Matt
Top achievements
Rank 1
Veli
Telerik team
Share this question
or