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






objectRelations
objectTypesInfo
Provides information about the type of the ParentCollection, the type of the Item, and the primary keys existed in the Item.
Construct WebGridObjectRelation and add it to an instantiated ArrayList.

Syntax

Visual Basic (Declaration) 
Public Sub SetObjectRelations( _
   ByVal objectRelations As ArrayList, _
   ByVal objectTypesInfo As ArrayList _
) 
Visual Basic (Usage)Copy Code
Dim instance As WebGrid
Dim objectRelations As ArrayList
Dim objectTypesInfo As ArrayList
 
instance.SetObjectRelations(objectRelations, objectTypesInfo)
C# 
public void SetObjectRelations( 
   ArrayList objectRelations,
   ArrayList objectTypesInfo
)
Delphi 
public procedure SetObjectRelations( 
    objectRelations: ArrayList;
    objectTypesInfo: ArrayList
); 
JScript 
public function SetObjectRelations( 
   objectRelations : ArrayList,
   objectTypesInfo : ArrayList
);
Managed Extensions for C++ 
public: void SetObjectRelations( 
   ArrayList* objectRelations,
   ArrayList* objectTypesInfo
) 
C++/CLI 
public:
void SetObjectRelations( 
   ArrayList^ objectRelations,
   ArrayList^ objectTypesInfo
) 

Parameters

objectRelations
objectTypesInfo
Provides information about the type of the ParentCollection, the type of the Item, and the primary keys existed in the Item.

Example

C#Copy Code
protected void WebGrid1_PreInitialize(object sender, System.EventArgs e)
{
    // assign OnPreInitialize event in ASPX
    // defines the Object Relations
    ArrayList objectRelations = new ArrayList();
    objectRelations.Add(new WebGridObjectRelation(
        typeof(CustomerCollection), "CustomerID", "Orders",
        typeof(OrderCollection), "CustomerID"));
    objectRelations.Add(new WebGridObjectRelation(
        typeof(OrderCollection), "OrderID", "OrderDetails",
        typeof(OrderDetailCollection), "OrderID"));
    
    // defines the Parent and Child Type information
    // objectTypes contains 3 object array: The parent collection type,
    // child item type, the primary keys of child collection
    // Primary keys can be string (if only 1 primary key defined),
    // or array of string for multiple primary keys scenario.
    ArrayList objectTypes = new ArrayList();
    objectTypes.Add(new object[] {
        typeof(CustomerCollection), typeof(Customer), "CustomerID"});
    objectTypes.Add(new object[] {
        typeof(OrderCollection), typeof(Order), "OrderID"});
    objectTypes.Add(new object[] {
        typeof(OrderDetailCollection), typeof(OrderDetail), new string[] {
        "OrderID", "ProductID"}});
    
    // assign the required definitions through SetObjectRelations method
    // the SetObjectRelations need to be called in new PreInitialize method
    // since it needs to be initialized in earliest phase.
    WebGrid1.SetObjectRelations(objectRelations, objectTypes);
}

Remarks

The SetObjectRelations method must be called in PreInitialize event in order for the Hierarchical Collection to work properly.

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.