Intersoft WebGrid Documentation
OnInitializeSelfReferenceDataSource Method
See Also  Example Send Feedback
ISNet.WebUI.WebGrid Namespace > WebGrid Class : OnInitializeSelfReferenceDataSource Method






table
dataSource
parentConstraints
customReqData
Invoked when ChildRows DataSource is retrieved in load on demand mode.

Syntax

Visual Basic (Declaration) 
Public Overridable Function OnInitializeSelfReferenceDataSource( _
   ByVal table As WebGridTable, _
   ByVal dataSource As Object, _
   ByVal parentConstraints As String, _
   ByVal customReqData As String _
) As Boolean
Visual Basic (Usage)Copy Code
Dim instance As WebGrid
Dim table As WebGridTable
Dim dataSource As Object
Dim parentConstraints As String
Dim customReqData As String
Dim value As Boolean
 
value = instance.OnInitializeSelfReferenceDataSource(table, dataSource, parentConstraints, customReqData)
C# 
public virtual bool OnInitializeSelfReferenceDataSource( 
   WebGridTable table,
   object dataSource,
   string parentConstraints,
   string customReqData
)
Delphi 
public function OnInitializeSelfReferenceDataSource( 
    table: WebGridTable;
    dataSource: TObject;
    parentConstraints: String;
    customReqData: String
): Boolean; virtual; 
JScript 
public function OnInitializeSelfReferenceDataSource( 
   table : WebGridTable,
   dataSource : Object,
   parentConstraints : String,
   customReqData : String
) : boolean;
Managed Extensions for C++ 
public: virtual bool OnInitializeSelfReferenceDataSource( 
   WebGridTable* table,
   Object* dataSource,
   string* parentConstraints,
   string* customReqData
) 
C++/CLI 
public:
virtual bool OnInitializeSelfReferenceDataSource( 
   WebGridTable^ table,
   Object^ dataSource,
   String^ parentConstraints,
   String^ customReqData
) 

Parameters

table
dataSource
parentConstraints
customReqData

Example

The sample code below shows you how to use InitializeSelfReferenceDataSource event.
C#Copy Code
private void WebGrid1_InitializeSelfReferenceDataSource(object sender,
ISNet.WebUI.WebGrid.ChildTableDataSourceEventArgs e)
{
    DataTable dt = (DataTable)e.DataSource;
    oleDbDataAdapter1.SelectCommand.CommandText =
        "select * from employees where ReportsTo =
        " + e.ParentKeyValues["EmployeeID"].ToString();
    oleDbDataAdapter1.SelectCommand.CommandType = CommandType.Text;
    oleDbDataAdapter1.Fill(dt);
}

Remarks

Since that both Hierarchical and SelfReferencing can be both enabled at the same time, load on demand for both features can also be enabled in such advanced scenarios. Simply handle InitializeChildTableDataSource for Hierarchical mode and InitializeSelfReferenceDataSource for SelfReferencing mode.

Requirements

Target Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family

See Also

©2012 Intersoft Solutions Corp. All Rights Reserved.