I am new to Infragistics controls. I am currently using a HierarchialDataGrid.
I found the way to obtain the datakey value for the selected row (inside the rowselectionchanged client-side event handler) for the root band using the following code.
var grid = $find("wsHierarchyEditGrid");
var rowid = grid.get_gridView().get_behaviors().get_selection().get_selectedRowsResolved()[0].get_dataKey();
But this does not work for the child band. Can someone please assist with how to retrieve the datakey value for the selected child band row?Thanks!
Hi, the following code should get you the dataKey for the row in context. Please make sure to set the datakey.rows[0].get_dataKey();Let me know if this does not work.
Thanks
How to get the child Datakey on c# to make it used by the next child band.
protected void WebHierarchicalDataGrid_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];
_itemClass.MyItemReqId = key;
var first = _itemClass.MyItemReqDetailQByItemReqIdRead();
// Create Container Grid
ContainerGrid childGrid = new ContainerGrid();
childGrid.InitializeRow += Child_InitializeeRow;
e.Row.RowIslands.Add(childGrid);
// Bind Grid
childGrid.DataSource = first;
childGrid.DataBind();
_itemClass.MyItemReqDetailId = //-----------------> GET keydata from first.
var second = _itemClass.MyErploctransByItemReqDetailIdRead();
ContainerGrid child1 = new ContainerGrid();
child1.InitializeRow += Child1_InitializeeRow;
e.Row.RowIslands[0].Rows[0].RowIslands.Add(child1);
child1.DataSource = second;
child1.DataBind();
}
Hi, sorry for the late answer. The issue seems to be in the sdk. You can try using some different event - for example ActiveCellChanged.Regards,Nikolai Dimitrov
Hi, I am sorry, did not follow our response completely. Were you saying above that there is a issue in my rowselectionchanged event code or in the sdk?I am currently trying to get the dataKey of selected row so I can present the user with an editmode form in a target iFrame. Due to complex nature of edit controls that is needed to be built, I currently provide the user with a readonly IG grid with row selection allowed and no in-line edit capability. Hence I am using the rowselectionchanged event to capture the dataKey.
Do you have any advice on how to overcome the javascript error (object var not set when I access data first time from another band)?Thanks,
It seems like there is an issue with the client side rowselectionchanged event. Is it necessary to get the selected rows on this event? Regards,Nikolai Dimitrov