Spread for ASP.NET 7.0 Product Documentation
DataModel Property
See Also  Example Support Options
FarPoint.Web.Spread Assembly > FarPoint.Web.Spread Namespace > SheetView Class : DataModel Property


Glossary Item Box

Gets or sets the data for the sheet.

Syntax

Visual Basic (Declaration) 
Public Property DataModel As ISheetDataModel
Visual Basic (Usage)Copy Code
Dim instance As SheetView
Dim value As ISheetDataModel
 
instance.DataModel = value
 
value = instance.DataModel
C# 
public ISheetDataModel DataModel {get; set;}

Property Value

ISheetDataModel object containing the data

Exceptions

ExceptionDescription
System.ArgumentNullExceptionData model is null; must have some value

Remarks

This property is available at run time only.

Example

This example assigns a SheetView object to the active sheet, creates a new Model object and binds it to a database, then assigns the model to the SheetViews DataModel.
C#Copy Code
FarPoint.Web.Spread.SheetView sv;
sv = FpSpread1.ActiveSheetView;
string conStr = "Provider=Microsoft.JET.OLEDB.4.0;data source=d:\\\\nwind.mdb";
string sqlStr = "SELECT * FROM Employees";
System.Data.OleDb.OleDbConnection conn = new System.Data.OleDb.OleDbConnection(conStr);
DataSet ds = new DataSet();
System.Data.OleDb.OleDbDataAdapter da = new System.Data.OleDb.OleDbDataAdapter(sqlStr, conn);
sv.DataMember = "Employees";
da.Fill(ds, sv.DataMember);
FarPoint.Web.Spread.Model.DefaultSheetDataModel model = new FarPoint.Web.Spread.Model.DefaultSheetDataModel(ds, "Employees");
sv.DataModel = model;
conn.Close();
Visual BasicCopy Code
Dim sv As FarPoint.Web.Spread.SheetView
sv = FpSpread1.ActiveSheetView
Dim conStr As String = "Provider=Microsoft.JET.OLEDB.4.0;data source=d:\\nwind.mdb"
Dim sqlStr As String = "SELECT * FROM Employees"
Dim conn As System.Data.OleDb.OleDbConnection = New System.Data.OleDb.OleDbConnection(conStr)
Dim ds As DataSet = New DataSet()
Dim da As System.Data.OleDb.OleDbDataAdapter = New System.Data.OleDb.OleDbDataAdapter(sqlStr, conn)
sv.DataMember = "Employees"
da.Fill(ds, sv.DataMember)
Dim model As New FarPoint.Web.Spread.Model.DefaultSheetDataModel(ds, "Employees")
sv.DataModel = model
conn.Close()

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.