Hi,
I have an ultrawebgrid with hierarchial data. I am exporting that data to excel.
I have the data in the following format.
Jan 09 Q01 09 Q02 09
ItemDescription Act Part Act Part Act Part like this...
I have three bands. When i export to excel i want the data to be in flat indentation. But it is getting exported in hierarchial indentation. How can i achive that. I tried setting the properties in export click event. But it doesn't seem to work....
Please help me out..
Hello,
To prevent the Child Band Indentation when exporting a Hierarchical WebGrid to EXCEL, check for the Child Band Key in the UltraWebGridExcelExporter HeaderRowExporting and RowExporting events and set the CurrentColumnIndex to 0.
The following code example demonstrates how:
protected
void UltraWebGridExcelExporter1_HeaderRowExporting(object sender, Infragistics.WebUI.UltraWebGrid.ExcelExport.HeaderRowExportingEventArgs e){ // Check for the Child Band Key from the Band // to set CurrentColumnIndex Indentation to 0 if (e.Band.Key == "[Child Band Key]") { e.CurrentColumnIndex = 0; }}
void UltraWebGridExcelExporter1_RowExporting(object sender, Infragistics.WebUI.UltraWebGrid.ExcelExport.RowExportingEventArgs e){ // Check for the Child Band Key from the GridRow // to set CurrentColumnIndex Indentation to 0 if (e.GridRow.Band.Key == "[Child Band Key]") { e.CurrentColumnIndex = 0; }}
Please let me know if this helps or if you have any questions.Sincerely,Mike D.Developer Support EngineerInfragistics, Inc.
hi Smriti_Subramanian
i am trying to export data into excel(ultragrid), i can bind the firm column and i am not able to bind the bands data,
can u paste the code or send me mail(narasimha_vardhi@yahoo.com)
it will great help if u send me the code.
Regards
Narasimha
I have the same problem: Exporting hierarchical data of the ultrawebgrid in flat format. I understand your logic, could you please give me a sample. I am using WebHierarchicalDataSource and two sqldatasource controls which bind to separate table. Thanks.
Yes, if you are binding to DataSet, it contains a number of DataTables in a relation, so you need to just construct one big DataTable prior to exporting on bind the grid to it.
Still, this really depends on the structure of the data you are binding to (e.g. do you have the same schema for all tables, etc)
Thanks. Enumerate all DataTables in the sense?