Spread ASP.NET 15
FarPoint.Web.Spread Assembly / FarPoint.Web.Spread.Model Namespace / IChildModelSupport Interface / GetChildDataModel Method
Row whose child data model is to be returned
Data relation name

In This Topic
    GetChildDataModel Method (IChildModelSupport)
    In This Topic
    Gets the child data model for the specified row and data relation.
    Function GetChildDataModel( _
       ByVal row As Integer, _
       ByVal relation As String _
    ) As ISheetDataModel
    Dim instance As IChildModelSupport
    Dim row As Integer
    Dim relation As String
    Dim value As ISheetDataModel
    value = instance.GetChildDataModel(row, relation)
    ISheetDataModel GetChildDataModel( 
       int row,
       string relation


    Row whose child data model is to be returned
    Data relation name

    Return Value

    ISheetDataModel containing the child data model
    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"]);
    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 number of rows in the child model is " & iModel.RowCount.ToString());
    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()); 
    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"))
    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 number of rows in the child model is " & iModel.RowCount.ToString())
    Private Sub FpSpread1ChildViewCreated(ByVal sender As Object, ByVal e As FarPoint.Web.Spread.CreateChildViewEventArgs) Handles
        Dim mTest As FarPoint.Web.Spread.Model.IChildModelSupport
        mTest = e.SheetView.DataModel
        Response.Write("The parent index is " & Convert.ToString(mTest.ParentRelationIndex))
    End Sub
    See Also