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

Label Inside Footer Template not Exporting

6 Answers 256 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jack
Top achievements
Rank 1
Jack asked on 02 May 2013, 06:48 AM
I have a FooterTemplate inside a Template Column of RadGrid inside which i have a label, i am updating that label value in javascript 
<FooterTemplate>
     <asp:Label ID="lblFooterValue" Font-Bold="true"  ForeColor="Green" Font-Size="15px"
         runat="server"></asp:Label>
     </FooterTemplate>


After all i am exporting RadGrid to excel but that label value is not coming in footer.
As i have another Bound Column in which i am also showig footer that  column's footer value is exporting well.but not my template column.
where i am doing wrong pls correct me

6 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 06 Aug 2013, 02:46 PM
Hi Jack,

I have tried a sample code to export to excel with footer,you can use ExcelFormat="Biff",it supports exporting footers.Please try the below code snippet.

ASPX:
<telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="false" DataSourceID="SqlDataSource1"
    GridLines="None" AllowPaging="true" AllowSorting="true" ShowFooter="true">
    <ExportSettings ExportOnlyData="true" OpenInNewWindow="true" IgnorePaging="true" Excel-Format="Html"></ExportSettings>
    <MasterTableView CommandItemDisplay="Top">
        <CommandItemSettings ShowExportToExcelButton="true" />
        <Columns>
            <telerik:GridBoundColumn UniqueName="OrderID" DataField="OrderID" HeaderText="OrderID" Aggregate="CountDistinct">
            </telerik:GridBoundColumn>
            <telerik:GridTemplateColumn HeaderText="ShipCity">
                <ItemTemplate>
                    <%# Eval("ShipCity") %>
                </ItemTemplate>
                <FooterTemplate>
                    <asp:Label ID="lblFooterValue" Font-Bold="true" ForeColor="Green" Font-Size="15px"
                        runat="server">ShipCity</asp:Label>
                </FooterTemplate>
            </telerik:GridTemplateColumn>
        </Columns>
    </MasterTableView>
</telerik:RadGrid>

Thanks,
Princy
0
Shubham
Top achievements
Rank 1
answered on 12 Feb 2014, 09:53 AM
Hi Princy 
                 I too want  to export the footer template in excel but unable  to do so. I have used your code but still  the issue is not resolved please let  me know what else we can try.

Thanks
0
Princy
Top achievements
Rank 2
answered on 12 Feb 2014, 10:40 AM
Hi Shubham,

I guess you are trying to export to Excel with format of ExcelML. Please take a look into this forum post, please try the code snippet provided in it.
http://www.telerik.com/forums/permalink/slPUWDfqj02dfZG6VslKDA

Thanks,
Princy

0
Shubham
Top achievements
Rank 1
answered on 12 Feb 2014, 11:48 AM
Hi princy 

               Thanks for the fast reply . I tried it with all  the format html,Biff,ExcelMl  but nothing  is working for me because  in "Biff" we  can not export child grid (unfortunately I have child grid) . and while using ExcelMl 
   I am unable to get footer template or GroupFootertemplate 

hare is  my code behind please have a look on it .
Int _currentGroup = 0;
 if (e.RowType == GridExportExcelMLRowType.GroupByHeaderRow)
        {
            int rowIndex = e.Worksheet.Table.Rows.IndexOf(e.Row);
            if (rowIndex != 0)
            {
                RowElement row = new RowElement();
                CellElement cell;
                GridGroupFooterItem item = RadGrid.MasterTableView.GetItems(GridItemType.GroupFooter)[_currentGroup] as GridGroupFooterItem;

                foreach (GridColumn column in RadGrid.MasterTableView.AutoGeneratedColumns)
                {
                    //cell = new CellElement();
                    //cell.Data.DataItem = footerItems[column.UniqueName].Text.Replace("&nbsp;", "");
                    //row.Cells.Add(cell);
                }

                e.Worksheet.Table.Rows.Insert(rowIndex, row);
            }

            _currentGroup++;



when I am  trying  to get Group footerItem the index was out of range exception occure dont know why
0
Viktor Tachev
Telerik team
answered on 17 Feb 2014, 09:36 AM
Hello,

I am attaching a sample project that illustrates how to export the content of a column FooterTemplate when Excel-Format is set to "Biff" or "Html".

Additionally you could try the approach for exporting data from GroupFooter illustrated in this thread.

Regards,
Viktor Tachev
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the UI for ASP.NET AJAX, subscribe to the blog feed now.
0
Shubham
Top achievements
Rank 1
answered on 20 Feb 2014, 10:58 AM
Hi Princy , Viktor Tachev  
both  of  u  are  correct  now  it  is  working  on my  side  a big  thanks  to  you  guys

Thanks 
SHubham
  
Tags
Grid
Asked by
Jack
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Shubham
Top achievements
Rank 1
Viktor Tachev
Telerik team
Share this question
or