Spread for ASP.NET 7.0 Product Documentation
GetChildRelation Method
See Also  Example Support Options
FarPoint.Web.Spread Assembly > FarPoint.Web.Spread.Model Namespace > IChildModelSupport Interface : GetChildRelation Method


index
Index to the child relation

Glossary Item Box

Gets the name of the child data relation at the specified position.

Syntax

Visual Basic (Declaration) 
Function GetChildRelation( _
   ByVal index As Integer _
) As String
Visual Basic (Usage)Copy Code
Dim instance As IChildModelSupport
Dim index As Integer
Dim value As String
 
value = instance.GetChildRelation(index)
C# 
string GetChildRelation( 
   int index
)

Parameters

index
Index to the child relation

Return Value

String containing the name of the child data relation

Example

C#Copy Code
string conStr = "Provider=Microsoft.JET.OLEDB.4.0;data source= d:\\Patients2000.mdb"; 
string sqlStr = "SELECT * FROM Patients"; 
System.Data.OleDb.OleDbConnection conn = new System.Data.OleDb.OleDbConnection(conStr); 
DataSet ds = new DataSet(); 
System.Data.OleDb.OleDbDataAdapter daCust = new System.Data.OleDb.OleDbDataAdapter(sqlStr, conn); 
daCust.Fill(ds, "Patients"); 
System.Data.OleDb.OleDbDataAdapter daOrder = new System.Data.OleDb.OleDbDataAdapter(sqlStr, conn); 
daOrder.Fill(ds, "Appointment"); 
DataRelation rel = new DataRelation("PatientRel", ds.Tables["Patients"].Columns["LName"], ds.Tables["Appointment"].Columns["LName"]);

ds.Relations.Add(rel); 
FpSpread1.DataSource = ds; 
FarPoint.Web.Spread.Model.IChildModelSupport cModel;
FarPoint.Web.Spread.Model.ISheetDataModel iModel;
Dim s As String;
cModel = (FarPoint.Web.Spread.Model.IChildModelSupport)FpSpread1.ActiveSheetView.DataModel;
s = cModel.GetChildRelation(0);
iModel = cModel.GetChildDataModel(0, s);
Response.Write(The name of the child relation is " + s);

private void FpSpread1ChildViewCreated(object sender, FarPoint.Web.Spread.CreateChildViewEventArgs e)
{
    FarPoint.Web.Spread.Model.IChildModelSupport mTest; 
    mTest = (FarPoint.Web.Spread.Model.IChildModelSupport)e.SheetView.DataModel; 
    Response.Write("The parent index is " + mTest.ParentRelationIndex.ToString()); 
}
Visual BasicCopy Code
Dim conStr As String = "Provider=Microsoft.JET.OLEDB.4.0;data source= d:\Patients2000.mdb"
Dim sqlStr As String = "SELECT * FROM Patients"
Dim conn As System.Data.OleDb.OleDbConnection = New System.Data.OleDb.OleDbConnection(conStr)
Dim ds As DataSet = New DataSet
Dim daCust As System.Data.OleDb.OleDbDataAdapter = New System.Data.OleDb.OleDbDataAdapter(sqlStr, conn)
daCust.Fill(ds, "Patients")
Dim daOrder As System.Data.OleDb.OleDbDataAdapter = New System.Data.OleDb.OleDbDataAdapter(sqlStr, conn)
daOrder.Fill(ds, "Appointment")
Dim rel = New DataRelation("PatientRel", ds.Tables("Patients").Columns("LName"), ds.Tables("Appointment").Columns("LName"))
ds.Relations.Add(rel)
FpSpread1.DataSource = ds
Dim cModel As FarPoint.Web.Spread.Model.IChildModelSupport
Dim iModel As FarPoint.Web.Spread.Model.ISheetDataModel
Dim s As String
cModel = FpSpread1.ActiveSheetView.DataModel
s = cModel.GetChildRelation(0)
iModel = cModel.GetChildDataModel(0, s)
Response.Write(The name of the child relation is " & s)

Private Sub FpSpread1ChildViewCreated(ByVal sender As Object, ByVal e As FarPoint.Web.Spread.CreateChildViewEventArgs) Handles
FpSpread1.ChildViewCreated
    Dim mTest As FarPoint.Web.Spread.Model.IChildModelSupport
    mTest = e.SheetView.DataModel
    Response.Write("The parent index is " & Convert.ToString(mTest.ParentRelationIndex))
End Sub

Requirements

Target Platforms: Windows 7, Windows 8, Windows Vista, Windows Server 2000, Windows 2000 Professional, Windows XP Professional, Windows NT 4.0 Workstation, SP6, Windows NT 4.0 Server, SP6

See Also

© 2002-2014 ComponentOne, a division of GrapeCity. All Rights Reserved.