Intersoft WebGrid Documentation
How-to: Use Hierarchical Client APIs
See Also Send comments on this topic.

Glossary Item Box

WebGrid provides a set of comprehensive client side API to let developers extend the Grid for their own use.

In this topic, you will learn how to use several hierarchical Client-Side APIs.

To obtain parent row's KeyValue in WebGrid

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.

  1. Drag WebGrid instance into the WebForm.
  2. Add a client side function.
  3. 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);
    }
    }

 

To expand/collapse WebGrid's child row

Use ExpandChildRow function to expand/collapse WebGrid child row in client side.

This topic will show you how to expand/collapse WebGrid's child row.

  1. Drag WebGrid instance into the WebForm.
  2. Add a Client-Side function.
  3. JavaScript Copy Code
    function expandChildRow()
    {
    var WebGrid1 = ISGetObject(controlId);
    var row = WebGrid1.RootTable.GetRowByKeyValue("ANATR");
    row.ExpandChildRow(true);
    return true;
    }
    function collapseChildRow()
    {
    var WebGrid1 = ISGetObject(controlId);
    var row = WebGrid1.RootTable.GetRowByKeyValue("ANATR");
    row.CollapseChildRow(true);
    return true;
    }

See Also

©2012 Intersoft Solutions Corp. All Rights Reserved.