Hello,
I have a RAD Grid within an asp panel and I am setting the panel's visibility to false. I binding data to this grid and then doing an export to excel on button click event. Since the panel's visibility is set to false the data for the column is exported and the column name does not appear. If I set the panel's visibility to true I can both data and the column name in the excel. This is my code hope somebody can help me on this:
ASPX code:
<asp:Panel ID="pnlGridDisplay" runat="server" Visible="false">
<telerik:RadGrid runat="server" ID="rgGrid" GridLines="None" AllowSorting="true" AllowPaging="false"
AllowFilteringByColumn="false" PageSize="30" AutoGenerateColumns="false" ShowGroupPanel="true" ShowFooter="false"
Width="200">
<MasterTableView DataKeyNames="GradID">
<Columns>
<telerik:GridBoundColumn HeaderText="ID" DataField="ID" UniqueName="ID" Visible="false"/>
<telerik:GridBoundColumn HeaderText="Email" DataField="Email" SortExpression="Email" UniqueName="Email"/>
</Columns>
</MasterTableView>
</telerik:RadGrid>
</asp:Panel>
C# code:
protected void btnExportRegistered_Click(object sender, EventArgs e)
{
rgGrid.DataSource = ds;
rgGrid.DataBind();
rgGrid.GridLines = GridLines.Both;
rgGrid.ExportSettings.IgnorePaging = true;
rgGrid.ExportSettings.ExportOnlyData = true;
rgGrid.ExportSettings.OpenInNewWindow = true;
rgGrid.MasterTableView.ExportToExcel();
}
So I get the excel file with bunch of email address's but no column name.
I have a RAD Grid within an asp panel and I am setting the panel's visibility to false. I binding data to this grid and then doing an export to excel on button click event. Since the panel's visibility is set to false the data for the column is exported and the column name does not appear. If I set the panel's visibility to true I can both data and the column name in the excel. This is my code hope somebody can help me on this:
ASPX code:
<asp:Panel ID="pnlGridDisplay" runat="server" Visible="false">
<telerik:RadGrid runat="server" ID="rgGrid" GridLines="None" AllowSorting="true" AllowPaging="false"
AllowFilteringByColumn="false" PageSize="30" AutoGenerateColumns="false" ShowGroupPanel="true" ShowFooter="false"
Width="200">
<MasterTableView DataKeyNames="GradID">
<Columns>
<telerik:GridBoundColumn HeaderText="ID" DataField="ID" UniqueName="ID" Visible="false"/>
<telerik:GridBoundColumn HeaderText="Email" DataField="Email" SortExpression="Email" UniqueName="Email"/>
</Columns>
</MasterTableView>
</telerik:RadGrid>
</asp:Panel>
C# code:
protected void btnExportRegistered_Click(object sender, EventArgs e)
{
rgGrid.DataSource = ds;
rgGrid.DataBind();
rgGrid.GridLines = GridLines.Both;
rgGrid.ExportSettings.IgnorePaging = true;
rgGrid.ExportSettings.ExportOnlyData = true;
rgGrid.ExportSettings.OpenInNewWindow = true;
rgGrid.MasterTableView.ExportToExcel();
}
So I get the excel file with bunch of email address's but no column name.