Hi, This should be quite simple but I could not find any code examples. I need to grab some values from the Parent row based on an "ActiveRow" in one of the Parent's Child rows. I did not see anything hanging off of the GridRow Class that would gain access to a Parent row.
Any help would be greatly appreciated! Thanks
Hi Arman,
You don't need to explicitly call commit, the changes will be saved to the datasource on the first postback.
When you add a new row, do you have to execute commit() to send the data to the database?
Arman
Hi Jason,
If you need any further assistance on the matter please do not hesitate to ask.
Hello Jason,
The parent row of an active cell could be accessed from the ActiveCellChanged event handler, using the following code:
function WebHierarchicalDataGrid1_Activation_ActiveCellChanged(sender, eventArgs)
{
var parentRow = eventArgs.getActiveCell().get_row().get_grid().get_parentRow();
var parentRowCell0 = parentRow.get_cell(0);
}
On a button click you could get the active cell and its parent row the following way:
function btnClicked() {
var grid = $find("WebHierarchicalDataGrid1");
var activeCell = grid.get_gridView().get_behaviors().get_activation().get_activeCellResolved();
var parentRow = activeCell.get_row().get_grid().get_parentRow();
If you have any further questions, please let me know.
I think this is close... However, please consider this example. we have a grid with a Customer (Parent), Orders (Children) relationship. Once the page is rendered to the client, the user is able to expand the grid on any Parent Row or we may choose to expand the entire grid by default. That all depends on how we want to display the data to the user.
If the user clicks on a label outside of the grid, we then call a Client Side JavaScript Function and obtain the ActiveRow. If the ActiveRow happens to be a "Child Row", there are a few hidden columns in the ActiveRow's Parent Row that we would like obtain and use as default values for the New Row we are about to add to the ActiveRow's Parent Child Rows.