Spread ASP.NET 6.0 Product Documentation
Parent Property
See Also  Example Send Feedback
FarPoint.Web.Spread Assembly > FarPoint.Web.Spread.Model Namespace > IChildModelSupport Interface : Parent Property


Glossary Item Box

Gets or sets the parent data source.

Syntax

Visual Basic (Declaration) 
Property Parent As IChildModelSupport
Visual Basic (Usage)Copy Code
Dim instance As IChildModelSupport
Dim value As IChildModelSupport
 
instance.Parent = value
 
value = instance.Parent
C# 
IChildModelSupport Parent {get; set;}

Property Value

Parent IChildModelSupport object

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; 
int i; 
cModel = (FarPoint.Web.Spread.Model.IChildModelSupport)FpSpread1.ActiveSheetView.DataModel; 
i = cModel.ChildRelationCount; 
Response.Write("The number of child relations " + i.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 model is " + mTest.Parent.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 i As Integer
cModel = FpSpread1.ActiveSheetView.DataModel
i = cModel.ChildRelationCount
Response.Write("The child relation count is " & i.ToString())

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 model is " & Convert.ToString(mTest.Parent))
End Sub

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

© 2002-2012 GrapeCity, Inc. All Rights Reserved.