Radgrid将数据导出为pdf / excel的超链接

时间:2014-01-14 14:11:09

标签: asp.net export-to-excel telerik-grid radgrid export-to-pdf

如标题所述,从radgrid导出数据时,它会将所述数据导出到pdf / excel文档中的超链接。但是,当导出到csv / word时,它会将其导出为纯文本。

以下是我的网格声明,其中包含用于导出数据的所有设置

<telerik:RadGrid ID="grdSummary" runat="server" AllowSorting="True" 
AutoGenerateColumns="False" CellSpacing="0" GridLines="None" 
height="150px" Width="99%" OnItemCommand="grdSummary_ItemCommand" >

<clientsettings allowcolumnsreorder="True" reordercolumnsonclient="True">
<selecting allowrowselect="True" /><scrolling allowscroll="true"
 usestaticheaders="false" />
</clientsettings>

<ExportSettings HideStructureColumns="true"></ExportSettings>
<mastertableview Width="100%" CommandItemDisplay="Top">

<CommandItemSettings ShowExportToWordButton="true" ShowExportToCsvButton="true" 
 ShowExportToPdfButton="true" ShowExportToExcelButton="true" 
ShowAddNewRecordButton="False" ShowRefreshButton="False">
</CommandItemSettings>

当调用执行导出命令的实际函数时,我有:

protected void grdSummary_ItemCommand(object sender, GridCommandEventArgs e)
    {
        if (e.CommandName == Telerik.Web.UI.RadGrid.ExportToCsvCommandName)
        {
            grdSummary.MasterTableView.ExportToCSV();
        }

        if (e.CommandName == Telerik.Web.UI.RadGrid.ExportToWordCommandName)
        {
            grdSummary.MasterTableView.ExportToWord();
        }

        if (e.CommandName == Telerik.Web.UI.RadGrid.ExportToPdfCommandName)
        {
            grdSummary.MasterTableView.ExportToPdf();
        }

        if (e.CommandName == Telerik.Web.UI.RadGrid.ExportToExcelCommandName)
        {
            grdSummary.MasterTableView.ExportToExcel();
        }
    }

1 个答案:

答案 0 :(得分:0)

事实证明,这些列设置为gridtemplatecolumn而不是使用gridboundcolumn,这反过来会导致超链接导出