This is my code to export my WHDG Records.
protected void lnkExporttoExcell_Click(object sender, EventArgs e)
{
eExporter.DataExportMode = DataExportMode..AllDataInDataSource;
if (eExporter.DataExportMode == DataExportMode..AllDataInDataSource)
WebHierarchicalDataGrid1.DataBind();
}
string fileName = HttpUtility.UrlEncode("Summary");
fileName = fileName.Replace("+", "%20");
eExporter.DownloadName = fileName;
eExporter.WorkbookFormat = Infragistics.Excel.WorkbookFormat.Excel2007;
eExporter.Export(WebHierarchicalDataGrid1);
But the data exported is only the parent which came from a sqldatasource
and it doesnt exported the records from my child band that uses manual on load demand.
Hi NewbApps,
When you are using manual load on demand with the WHDG, the data for your child bands can not be exported as they are not yet bound to your data source.
Please refer to the DataExportMode API for more information:
http://help.infragistics.com/NetAdvantage/ASPNET/2011.1/CLR4.0/?page=Infragistics4.Web.v11.1~Infragistics.Web.UI.GridControls.DataExportMode.html
Can you provide me with some more information on what type of data source you are using for your child bands ?
Petar IvanovDeveloper Support EngineerInfragistics, Inc.http://ko.infragistics.com/support
I am using DataTable in binding my Childbands :
Level | Datasource | Binding | DataKey/Relation
Parent | sqlserver | sqldatasource/view | PK_ItemID
secondLevel | datatable | manual on load demand | PK_ItemDetailID, FK_ItemID
thirdLevel | datatable | manual on load deman | PK_ID,FK_itemDetailID
this is the Example of my code:
protected void btnSearch_Click(object sender, EventArgs e)
WebHierarchicalDataSource1.DataBind();
protected void WebHierarchicalDataGrid1_RowIslandsPopulating(object sender, ContainerRowCancelEventArgs e)
//Cancel the default automatic load on demand operation
e.Cancel = true;
switch (e.Row.Level)
case 0:
BindSecondLevel(e);
break;
case 1:
BindThirdLevel(e);
private void BindSecondLevel(Infragistics.Web.UI.GridControls.ContainerRowCancelEventArgs e)
// Get the data key
int key = (int)e.Row.DataKey[0];
var firstchild = ReadChildFromKey(key); //RETURNS DATABLE
// Create Container Grid
ContainerGrid childGrid = new ContainerGrid();
childGrid.InitializeRow += Child_InitializeeRow;
e.Row.RowIslands.Add(childGrid);
// Bind Child Grid
childGrid.DataKeyFields = "ID";
childGrid.Level = 1;
childGrid.DataSource = firstchild;
childGrid.DataBind();
private void BindThirdLevel(Infragistics.Web.UI.GridControls.ContainerRowCancelEventArgs e)
//Logic same as BindSecondLevel child2
protected void Child_InitializeeRow(object sender, RowEventArgs e)
var gridRecord = (ContainerGridRecord)e.Row;
if (gridRecord.Items.Count == 0)
return;
// Sets the ItemREQDetailId Column
var columnItemREQDetailId = (BoundDataField)gridRecord.Items[0].Column;
columnItemREQDetailId.Hidden = true;
protected void Child2_InitializeeRow(object sender, RowEventArgs e)
/ / Same as Child
protected void WebHierarchicalDataGrid1_Init(object sender, EventArgs e)
WebHierarchicalDataGrid1.RowIslandsPopulating += WebHierarchicalDataGrid_RowIslandsPopulating;
WebHierarchicalDataGrid1.InitializeRow += WebHierarchicalDataGrid_InitializeRow;