Question

As stated in the title, when exporting data from a radgrid it exports said data to hyperlinks within the pdf/excel document. However, when exporting to csv/word it exports it as plain text.

Below is the declaration of my grid with all the settings used to export the data

<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>

And when calling the actual function for executing the export command, I have:

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();
        }
    }
Was it helpful?

Solution

Turns out that the columns were set as gridtemplatecolumn instead of using gridboundcolumn, which then in turn resulted in the hyperlink exports

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top