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

preventing the autogenerate columns from reordering themselves

1 Answer 51 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Sayle
Top achievements
Rank 1
Sayle asked on 05 Jul 2012, 11:17 PM
I have a very wide RadGrid (the latest public release version) that I'm using as an export into Excel. I have the root query ordering the columns a certian way - the way the customers want the Excel output in... However, when I databind my RadGrid on the webpage, the columns are automatically reordered into alphabetical order!

How do I preventing the autogenerated columns from reordering themselvesinto alphabetical order?

Thanks
<telerik:RadGrid ID="gridSellerData" runat="server" Width="100%" CellSpacing="0" CellPadding="0"
    PageSize="5000" EnableLinqExpressions="False" HeaderStyle-Wrap="false" BorderColor="Black" BorderStyle="Solid" BorderWidth="1px" Skin="Hay"
    OnItemDataBound="grid_ItemDataBound" OnNeedDataSource="grid_NeedDataSource"
    OnPreRender="gridContractData_PreRender" OnGridExporting="gridSellerData_GridExporting"
    >
    <ClientSettings AllowColumnsReorder="false">
        <Selecting EnableDragToSelectRows="false" UseClientSelectColumnOnly="false" />
        <Scrolling AllowScroll="true" UseStaticHeaders="true" FrozenColumnsCount="0" />
    </ClientSettings>
    <ExportSettings IgnorePaging="true" ExportOnlyData="true" Excel-Format="ExcelML" OpenInNewWindow="true" HideStructureColumns="true" />
    <MasterTableView CommandItemDisplay="Top" DataKeyNames="LoanImportID" ClientDataKeyNames="LoanImportID" GridLines="Both">
        <CommandItemSettings ExportToExcelText="Export To Excel" ShowExportToExcelButton="true" ShowAddNewRecordButton="false" ShowRefreshButton="false" />
        <ItemStyle CssClass="Row0" />
        <AlternatingItemStyle CssClass="Row1" />
    </MasterTableView>
    <HeaderStyle Wrap="False" />
    <FilterMenu EnableImageSprites="False">
    </FilterMenu>
    <HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Hay">
    </HeaderContextMenu>
</telerik:RadGrid>

1 Answer, 1 is accepted

Sort by
0
Accepted
Antonio Stoilkov
Telerik team
answered on 10 Jul 2012, 12:57 PM
Hello Miles,

The RadGrid does not provide methods and properties for customizing order of auto generated columns. You could achieve your scenario by using manually declared columns which you could order depending on your needs. Note that RadGrid auto generated columns are for basic scenarios and in case when more advanced functionality is needed a manual approach is recommended.

Kind regards,
Antonio Stoilkov
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
Sayle
Top achievements
Rank 1
Answers by
Antonio Stoilkov
Telerik team
Share this question
or