Trek Innovations

Thoughts For You

Archive for April, 2009

Export NestedGridView To Excel

In order to export the nested gridview please follow the code below.

SalesReport.Ascx

<%@ Control Language=”C#” AutoEventWireup=”true” Codebehind=”SalesReport.ascx.cs”
Inherits=”Epod.UserControls.SalesReport” %>
<div id=”divgridView” class=”grid”>
<asp:GridView ID=”gvProducts” runat=”server” AllowSorting=”false” AllowPaging=”false” AutoGenerateColumns=”False”
CellPadding=”4″ GridLines=”None” ShowFooter=”false” OnRowCommand=”gvProducts_RowCommand”
Width=”100%”>
<Columns>
<asp:TemplateField ItemStyle-HorizontalAlign=”Left”>
<ItemTemplate>
<tr>
<td>
<asp:LinkButton ID=”_btnExpandandCollapse” runat=”server” Text=”<img src=’../images/expand.gif’ alt=’Expand to see detailed report’ border=’0′ />”
CssClass=”GridViewDataHyperLink” CommandArgument=’<%# Container.DataItemIndex %>’
CommandName=’<%# Eval(“ProductId_pk”) %>’ ToolTip=”Expand to see the detailed report”></asp:LinkButton>&nbsp;&nbsp;
<asp:Label ID=”_lblEmployeeName” Font-Bold=”true” runat=”server” Text=’<%# Eval(“ProductName”) %>’></asp:Label>

Read more

Share This Post No comments