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

Radgrid excel export

5 Answers 109 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Partha
Top achievements
Rank 1
Partha asked on 20 Jul 2011, 10:51 AM


when i am exporting from radgrid  to excel the column headers are getting displayed in the excel sheet as hyperlinks.presently i am having ExportOnlyData=false and  allowsorting=false when i am exporting.The problem is that with the present settings(Exportonlydata=false and allowsorting =false) I am not able to remove the hyperlinks(column header) from the excel sheet.I want the header text to be appearing like normal text. Here is the code :

  <telerik:RadGrid ID="ModifiedContentsReportGrid" runat="server" AutoGenerateColumns="false"
                AllowPaging="true" EnableOutsideScripts="true" PagerStyle-Mode="NextPrevAndNumeric"
                ShowFooter="true" OnItemCreated="ModifiedContentsReportsGrid_OnItemCreated" Title="Modified Content Report"
                Height="100%" ExportSettings-ExportOnlyData="false" EnableViewState="true">
                <ItemStyle BackColor="transparent" />
                <AlternatingItemStyle BackColor="#F9F9F9" />
                <ExportSettings OpenInNewWindow="true" FileName="Modified Content Report" ExportOnlyData="false">
                    <Pdf PaperSize="A4" AllowPrinting="true" PageBottomMargin="10px" PageTopMargin="25px"
                        PageHeaderMargin="0px" PageLeftMargin="10px" PageRightMargin="10px" PageTitle="Modified Content Report" />
                </ExportSettings>
                <HeaderStyle HorizontalAlign="Center" />
                <ClientSettings>
                    <Scrolling UseStaticHeaders="true" />
                </ClientSettings>
                <MasterTableView Width="100%" CommandItemDisplay="Top" CommandItemStyle-HorizontalAlign="Right"
                    TableLayout="Fixed">
                    <CommandItemTemplate>
                        <asp:Literal runat="server"><b>Account Name :</b></asp:Literal>
                        <asp:Label ID="lblClientName" runat="server" /><br />
                        <asp:Literal runat="server"><b>Report generated on :</b></asp:Literal>
                        <asp:Label ID="lblGenerateDate" runat="server" /><br />
                        <asp:Literal runat="server"><b>Date Range :</b></asp:Literal>
                        <asp:Label ID="lblDateRange" runat="server" />
                    </CommandItemTemplate>
                    <Columns>
                        <telerik:GridBoundColumn DataField="Name" SortExpression="Name" HeaderText="Content File"
                            SortAscImageUrl="/Images/SortAsc.gif" SortDescImageUrl="/Images/SortDesc.gif"
                            ItemStyle-Width="30%">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="Location" SortExpression="Location" HeaderText="Location"
                            SortAscImageUrl="/Images/SortAsc.gif" SortDescImageUrl="/Images/SortDesc.gif"
                            ItemStyle-Width="30%">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="Project/Folder" SortExpression="Project/Folder"
                            HeaderText="Project/Folder" SortAscImageUrl="/Images/SortAsc.gif" SortDescImageUrl="/Images/SortDesc.gif"
                            ItemStyle-Width="10%">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="Document" SortExpression="Document" HeaderText="Document"
                            SortAscImageUrl="/Images/SortAsc.gif" SortDescImageUrl="/Images/SortDesc.gif"
                            ItemStyle-Width="10%">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="Section" SortExpression="Section" HeaderText="Section"
                            SortAscImageUrl="/Images/SortAsc.gif" SortDescImageUrl="/Images/SortDesc.gif"
                            ItemStyle-Width="10%">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="JobNumber" SortExpression="JobNumber" HeaderText="Job Number"
                            SortAscImageUrl="/Images/SortAsc.gif" SortDescImageUrl="/Images/SortDesc.gif"
                            ItemStyle-Width="10%">
                        </telerik:GridBoundColumn>
                    </Columns>
                    <NoRecordsTemplate>
                        <asp:Literal runat="server">
                    No records to display.</asp:Literal>
                    </NoRecordsTemplate>
                </MasterTableView>
                <PagerStyle Mode="NextPrevAndNumeric" />
            </telerik:RadGrid>

5 Answers, 1 is accepted

Sort by
0
German
Top achievements
Rank 1
answered on 20 Jul 2011, 03:15 PM
I have the same issue >:
0
German
Top achievements
Rank 1
answered on 20 Jul 2011, 03:34 PM
on your vb page, on the section you export to excel you need to add this code to every column
for example:

whatever_ID.Columns(0).SortExpression =

String.Empty

 

0
Partha
Top achievements
Rank 1
answered on 29 Aug 2011, 10:04 AM
I am working in ASP.NET using C#  and I am implementing   a different sorting method for the grid.Can anyone help with this issue?
0
Jayesh Goyani
Top achievements
Rank 2
answered on 30 Aug 2011, 10:17 AM
Hello,

Please check below link for reference.
sorting in Radgrid

In this itemCommanevent()  they are manully sort the column.


Thanks,
Jayesh Goyani
0
Partha
Top achievements
Rank 1
answered on 23 Nov 2011, 08:17 AM
Hi all,

Please try adding HeaderButtonType="TextButton" in each of the GridBoundColumn and then export .It is working for me.

Thanks,
Partha.
Tags
Grid
Asked by
Partha
Top achievements
Rank 1
Answers by
German
Top achievements
Rank 1
Partha
Top achievements
Rank 1
Jayesh Goyani
Top achievements
Rank 2
Share this question
or