Intersoft WebGrid Documentation
Walkthrough: Creating Self Reference LoadOnDemand WebGrid
See Also Send comments on this topic.
Intersoft WebGrid > Learning More > Working with Self Referencing Table > Walkthrough: Creating Self Reference LoadOnDemand WebGrid

Glossary Item Box

This walkthrough shows you how to create Self Reference LoadOnDemand in WebGrid.

During this walkthrough, you will learn how to do the following:

 Prerequisites

In order to complete this walkthrough, you will need the following:

  • Visual Studio 2005/2008/2010 Application.

 Step-By-Step Instructions

To create new web application and specify Self Reference LoadOnDemand in WebGrid.

  1. Open WebGrid.NET Designer, Advanced, click See All Properties.
  2. Select RootTable.
  3. Expand SelfReferenceSettings.
  4. Set ParentDataMember to EmployeeID.
  5. Set ChildDataMember to ReportsTo.
  6. Set ExpandColumnMember to FirstName.
  7. Set Enabled to True.

    SelfRefDes

  8. Drag ISDataSource control from toolbox to the designer surface.
  9. Configure Data Source for the newly created ISDataSource.
  10. Select DataSet for the SchemaType.
  11. Click Schema Name dropdown and select dsNorthWind from the list.
  12. In the next dialog, click Add button then select Employees in the dropdown menu.
  13. In the Select Method dropdown list, select GetDataBy(Nullable<Int32> ReportsTo) method. 
  14. Click Finish.

    ISDSSelfRef1

  15. Open ISDataSource .NET Designer.
  16. Click on Employees table.
  17. Set SelectSelfReferenceRowMethod to GetDataBy.

    ISDSSElfRef2

  18. Drag WebGrid control from toolbox to the designer surface.
  19. Set the DataSourceID to ISDataSource1.

    a

  20. In the Connect to DataSource dialog, select Retrieve  Structure, choose "Employees" table then click OK.
  21. Open WebGrid.NET Designer >> Advanced and click See all properties.
  22. Expand SelfReferencingSettings, set Enabled to True, set ExpandColumnMember to FirstName, set ChildDataMember to ReportsTo and ParentDataMember to EmployeeID.
  23. In SelfReferencingSettings, remember to set LoadOnDemand to True.

    SelfRefLOD

See Also

©2012 Intersoft Solutions Corp. All Rights Reserved.