Good Day,
I am attempting to export the Web Hierarchical Data Grid to excel using the Web Excel Exporter control. My controls are currently sitting inside of an UpdatePanel control. I have set that to Conditional and set the "Export to Excel" button as a postback trigger. All is working well and it saves correctly. However, upon opening the file, all of the cells are empty in the excel worksheet.
This is my click event code (server side) for the excel export button, also, my grid is loaded dynamically from an ienumerable object:
protected void btnSchedule_ExportExcel_Click(object sender, EventArgs e)
{
LoadScheduleGrid();
this.weeSchedule.DownloadName = string.Format("HPDSchedule_{0}", DateTime.Now.ToString("MM-dd-yy(HHmm)"));
this.weeSchedule.ExportMode = ExportMode.Download;
this.weeSchedule.WorkbookFormat = Infragistics.Documents.Excel.WorkbookFormat.Excel97To2003;
this.weeSchedule.Export(this.whdgSchedule);
}
Thank you again, I have just posted a new issue in a different thread (didn't want to keep tacking on here) related to exporting to excel with multiple grids. http://community.infragistics.com/forums/p/63498/321607.aspx#321607
Hi jasonwilczak,
Glad that I was able to help. Please feel free to contact me if you need further assistance.
Best Regards,
Petar IvanovDeveloper Support EngineerInfragistics, Inc.http://ko.infragistics.com/support
Worked perfectly, thank you for all you're help!!
In order to expand the rows in the exported documents you can call the following function after calling DataBind() on the grid:
protected void ExpandAll() { foreach (ContainerGridRecord row in WebHierarchicalDataGrid1.GridView.Rows) { row.ExpandChildren(); } }
protected void ExpandAll() { foreach (ContainerGridRecord row in WebHierarchicalDataGrid1.GridView.Rows) { row.ExpandChildren();
} }
Please tell me if this works.
Thank you, that was it. I called "DataBind()" method after the LoadScheduleGrid() method and before the export function and it all worked well. Quick question, the export to excel seems to have all the parent rows collapsed by default, how would I make it so all rows were expanded in the exported excel version?