Intersoft WebGrid Documentation
How-to: Get parent row's KeyValue
See Also Send comments on this topic.

Glossary Item Box

In hierarchical grid scenario, we can get parent row's KeyValue from child table.

This topic will show you how to obtain parent's row KeyValue.

To obtain parent row's KeyValue in WebGrid

  1. Drag WebGrid instance into the WebForm.
  2. Add a client side function on your code.
  3. You can obtain parent's row KeyValue by simply using:

  4. JavaScript Copy ImageCopy Code
    function GetParentRow()
    {
    var grid = ISGetObject("WebGrid1");
    var selObj = grid.GetSelectedObject();
    var row = selObj.GetRowObject();
    if (row.Table.IsRootTable)
    alert("Please select a child row");
    else
    {
    var parentRow = row.GetParentRow(); // get the parent row of this child
    alert("The parent row of this order is: " + parentRow.KeyValue);
    }
    }

See Also

©2012 Intersoft Solutions Corp. All Rights Reserved.