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

Export Column problem in Excel

1 Answer 14 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Rahul
Top achievements
Rank 1
Rahul asked on 20 Nov 2013, 09:40 AM
Team

I am having issue with Template Column it contains Linkbutton. When i click on Export to excel in this case values comes balnk in excel.

I treid both ExportOnlyData  by setting True/ False. If i set False then it exporting all filter opeiton to in Excel.


Please let me know how we will exportTemplate column with link button in excel.

Thanks
Rahul

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 20 Nov 2013, 10:35 AM
Hi Rahul,

Please try the following code snippet to export TemplateColumn to Excel.

ASPX:
<telerik:RadGrid ID="RadGrid1" runat="server" AllowFilteringByColumn="true"    OnItemCommand="RadGrid1_ItemCommand">
    <ExportSettings ExportOnlyData="false">
    </ExportSettings>
    <MasterTableView DataKeyNames="OrderID" CommandItemDisplay="Top">
        <CommandItemSettings ShowExportToExcelButton="true" />
        <Columns>
            <telerik:GridBoundColumn UniqueName="OrderID" DataField="OrderID" HeaderText="OrderID" />
            <telerik:GridBoundColumn DataField="ShipCity" HeaderText="ShipCity" UniqueName="ShipCity" />
            <telerik:GridTemplateColumn HeaderText="TemplateColumn">
                <ItemTemplate>
                    <asp:LinkButton ID="LinkButton1" runat="server">LinkButton</asp:LinkButton>
                </ItemTemplate>
            </telerik:GridTemplateColumn>
        </Columns>
    </MasterTableView>
</telerik:RadGrid>

C#:
protected void RadGrid1_ItemCommand(object sender, GridCommandEventArgs e)
{
    if (e.CommandName == RadGrid.ExportToExcelCommandName)
    {
        RadGrid1.MasterTableView.CommandItemDisplay = GridCommandItemDisplay.None;
        RadGrid1.AllowFilteringByColumn = false;
        RadGrid1.Rebind();
    }
}

Thanks,
Princy
Tags
Grid
Asked by
Rahul
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or