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

[Solved] Export to Excel: Column order problem

1 Answer 140 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Bogice
Top achievements
Rank 1
Bogice asked on 11 Jan 2010, 07:09 PM
Hi Telerik,
I have problem with export to excel: my Location should be in the 3rd position show as last column in the report. Here is the code

<telerik:RadGrid ID="grdWarranty" runat="server" AllowPaging="True" AllowSorting="True" 
    AutoGenerateColumns="False" GridLines="None" Skin="Default" Width="700px" PageSize="7" 
    OnNeedDataSource="grdWarranty_NeedDataSource" OnItemCommand="grdWarranty_ItemCommand" 
    OnItemCreated="grdWarranty_ItemCreated" ShowStatusBar="true"
    <MasterTableView Width="100%" UseAllDataFields="True" TableLayout="Fixed" DataKeyNames="CompanyID,LocationID,ObjectType,ObjectID"
        <RowIndicatorColumn> 
            <HeaderStyle Width="20px" /> 
        </RowIndicatorColumn> 
        <ExpandCollapseColumn> 
            <HeaderStyle Width="20px" /> 
        </ExpandCollapseColumn> 
        <Columns> 
            <telerik:GridTemplateColumn HeaderText="Name" DataField="ObjectName" SortExpression="ObjectName"
                <ItemTemplate> 
                    <asp:LinkButton ID="LinkButtonOpen" runat="server" CausesValidation="False" CommandName='<%# DataBinder.Eval(Container, "DataItem.ObjectType") %>' 
                        CommandArgument='<%# DataBinder.Eval(Container, "DataItem.ObjectID") %>' Text='<%# DataBinder.Eval(Container, "DataItem.ObjectName") %>' /> 
                    <asp:Label runat="server" ID="lblName" Visible="false" Text='<%# DataBinder.Eval(Container, "DataItem.ObjectName") %>'></asp:Label> 
                </ItemTemplate> 
            </telerik:GridTemplateColumn> 
            <telerik:GridBoundColumn HeaderText="Type" DataField="ObjectType"
            </telerik:GridBoundColumn> 
            <telerik:GridTemplateColumn HeaderText="Location" DataField="LocationName" SortExpression="LocationName"
                <ItemTemplate> 
                    <%# LocationDisp(DataBinder.Eval(Container, "DataItem.LocationName").ToString()) %> 
                </ItemTemplate> 
            </telerik:GridTemplateColumn> 
            <telerik:GridTemplateColumn HeaderText="Expires" DataField="ExpirationDateFormatted" SortExpression="ExpirationDate"
                <ItemTemplate> 
                    <%# DateString.GetDateValue(DataBinder.Eval(Container, "DataItem.ExpirationDate").ToString()).ToString("M/d/yyyy").Replace("1/1/1900", "") %> 
                </ItemTemplate> 
            </telerik:GridTemplateColumn> 
            <telerik:GridTemplateColumn HeaderText="# Days" DataField="ExpirationDays" SortExpression="ExpirationDate"
                <ItemTemplate> 
                    <%# GetExpiration(DataBinder.Eval(Container, "DataItem.ExpirationDate").ToString()) %> 
                </ItemTemplate> 
            </telerik:GridTemplateColumn> 
        </Columns> 
    </MasterTableView> 
    <PagerStyle AlwaysVisible="true" Mode="NumericPages" /> 
    <ClientSettings EnableAlternatingItems="true" EnableRowHoverStyle="true"
        <Scrolling AllowScroll="true" ScrollHeight="185px" UseStaticHeaders="true" /> 
    </ClientSettings> 
</telerik:RadGrid> 
What am i missing?
Thank you


1 Answer, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 14 Jan 2010, 12:52 PM
Hello Bogice,

Please examine this thread:
Export to Excel missing column

Regards,
Daniel
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Grid
Asked by
Bogice
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Share this question
or