I am using Manual On Load Demand to Bind child grid in my WHDG.
This is My Code:
protected void WebHierarchicalDataGrid1_RowIslandsPopulating(object sender, ContainerRowCancelEventArgs e)
{
//Cancel the default automatic load on demand operation
e.Cancel = true;
// Get the data key
int key = (int)e.Row.DataKey[0];
_item.DetailId = key;
var p = itemRead();
// Create Container Grid
ContainerGrid childGrid = new ContainerGrid();
childGrid.InitializeRow += Child_InitializeeRow;
e.Row.RowIslands.Add(childGrid);
// Bind Grid
childGrid.DataSource = p;
childGrid.DataBind();
}
private bool isChild;
protected void Child_InitializeeRow(object sender, RowEventArgs e)
isChild = true;
var gridRecord = (ContainerGridRecord)e.Row;
if (gridRecord.Items.Count == 0)
return;
// Sets theItem Column
var columnItemID = (BoundDataField)gridRecord.Items[0].Column;
columnItemID.Width = 200;
columnItemID.Header.Text = "ItemID";
// ---------------------------------
In this Area i need to insert a check box which will be the last column
//------------------------------------
I got this code from the other thread but i don't know how to use it yet:
public class ActionChildItemTemplate : ITemplate
#region ITemplate Member
public void InstantiateIn(Control container)
CheckBox chk = new CheckBox();
chk.ID = "chk";
container.Controls.Add(chk);
#endregion
After that i need to loop the child band that is checked by the user and reference the key from parent row.
Thanks in Regards
Hi NewbApps,
It has been some time since your post, however in case you still need assistance I would be glad to help.
You should be able to add a templated column to your container grid inside the RowIslandsPopulating handler using something similar to:
TemplateDataField col = new TemplateDataField(); col.ItemTemplate = new ActionChildItemTemplate(); col.Key = "tempCol"; if (child.Columns.FromKey("tempCol") == null) { child.Columns.Add(col); }
TemplateDataField col = new TemplateDataField(); col.ItemTemplate = new ActionChildItemTemplate(); col.Key = "tempCol";
if (child.Columns.FromKey("tempCol") == null) { child.Columns.Add(col); }
where child is the container grid element.
Please feel free to contact me if you have any questions.
Best Regards,
Petar IvanovDeveloper Support EngineerInfragistics, Inc.http://es.infragistics.com/support