exporttoexcel does not include template columns

4 posts, 0 answers
  1. Kod
    Kod avatar
    14 posts
    Member since:
    Oct 2017

    Posted 27 Oct 2017 Link to this post

    Hello,

    I am trying to implement Export To Excel functionality. The issue is it does not include template columns in exported file. I am sharing my markup and code here:

    protected void imgBtn_EXP_Requests_Click(object sender, EventArgs e)
           {
               RadGrid.MasterTableView.ExportToExcel();
           }
    <telerik:RadGrid RenderMode="Lightweight" ID="RadGrid" AllowSorting="True" EnableViewState="true" PageSize="35" AllowPaging="True" AllowCustomPaging="false"
                    AllowAutomaticUpdates="True" AllowAutomaticInserts="True" runat="server" AutoGenerateColumns="false" GridLines="None" AllowFilteringByColumn="true"
                    GroupingSettings-CaseSensitive="false" ExportSettings-FileName="Dashboard" ExportSettings-ExportOnlyData="true" ExportSettings-OpenInNewWindow="true"
                    ExportSettings-IgnorePaging="true" OnItemCommand="RadGrid_ItemCommand" OnItemDataBound="RadGrid_ItemDataBound">               
                    <PagerStyle Mode="NextPrevAndNumeric" AlwaysVisible="true"></PagerStyle>
                    <ClientSettings>
                        <Scrolling AllowScroll="true" UseStaticHeaders="true" SaveScrollPosition="true" FrozenColumnsCount="2" />
                    </ClientSettings>
                    <MasterTableView Width="100%" CommandItemDisplay="Top" EnableViewState="true" TableLayout="Fixed"
                        DataKeyNames="Id" AutoGenerateColumns="false" InsertItemPageIndexAction="ShowItemOnCurrentPage" >
                        <CommandItemSettings ShowAddNewRecordButton="false" />
                        <CommandItemSettings ShowRefreshButton="false" />                   
                        <Columns>
                            <telerik:GridBoundColumn DataField="Id" UniqueName="Id" HeaderText="Id"
                                AllowSorting="false" ItemStyle-Wrap="false" HeaderStyle-Wrap="false" AllowFiltering="false">
                            </telerik:GridBoundColumn>                                            
                            <telerik:GridTemplateColumn HeaderText="Request Id" ShowFilterIcon="false" UniqueName="RequestId">
                                <ItemTemplate>                               
                                    <asp:LinkButton ID="lnkbtnRequestId" CausesValidation="false" runat="server" Text='<%#Eval("RequestId") %>'></asp:LinkButton>
                                </ItemTemplate>
                            </telerik:GridTemplateColumn>
                            <telerik:GridTemplateColumn HeaderText="Record (Title)" ShowFilterIcon="false" UniqueName="Title">
                                <ItemTemplate>
                                    <asp:LinkButton ID="lnkbtnTitle" CausesValidation="false" runat="server" Text='<%#Eval("Title") %>'></asp:LinkButton>
                                </ItemTemplate>
                            </telerik:GridTemplateColumn>                                                
                        </Columns>
                    </MasterTableView>               
                </telerik:RadGrid>
  2. Kod
    Kod avatar
    14 posts
    Member since:
    Oct 2017

    Posted 27 Oct 2017 in reply to Kod Link to this post

    I have already tried adding DataField to template column. No luck. 
  3. Kod
    Kod avatar
    14 posts
    Member since:
    Oct 2017

    Posted 27 Oct 2017 in reply to Kod Link to this post

    I have already tried adding DataField to the template column. No luck.
  4. Kod
    Kod avatar
    14 posts
    Member since:
    Oct 2017

    Posted 31 Oct 2017 Link to this post

    Here is the solution.

    https://vishnukj.wordpress.com/2014/10/30/fix-for-exporting-values-in-template-columns-to-excel-for-telerik-radgrid/

Back to Top