Spread for ASP.NET 7.0 Product Documentation
AddRowToDataSource Method
See Also  Example Support Options
FarPoint.Web.Spread Assembly > FarPoint.Web.Spread.Model Namespace > DefaultSheetDataModel Class : AddRowToDataSource Method


row
Row index at which to add a row
autoFillData
Whether to automatically fill the row with data

Glossary Item Box

Adds the unbound row to the data source.

Syntax

Visual Basic (Declaration) 
Public Sub AddRowToDataSource( _
   ByVal row As Integer, _
   ByVal autoFillData As Boolean _
) 
Visual Basic (Usage)Copy Code
Dim instance As DefaultSheetDataModel
Dim row As Integer
Dim autoFillData As Boolean
 
instance.AddRowToDataSource(row, autoFillData)
C# 
public void AddRowToDataSource( 
   int row,
   bool autoFillData
)

Parameters

row
Row index at which to add a row
autoFillData
Whether to automatically fill the row with data

Example

This example adds an unbound row to the sheet, then adds that row to the data source.
C#Copy Code
FarPoint.Web.Spread.Model.DefaultSheetDataModel dataModel = new FarPoint.Web.Spread.Model.DefaultSheetDataModel(); 
DataSet ds = new DataSet(); 
DataTable name; 
name = ds.Tables.Add("Name"); 
name.Columns.Add("FirstName", Type.GetType("System.String")); 
name.Columns.Add("LastName", Type.GetType("System.String")); 
name.Rows.Add(new object[] {"John", "Doe"}); 
name.Rows.Add(new object[] {"Sally ", "Jones"}); 
name.Rows.Add(new object[] {"Terry", "Hernandez"}); 
FpSpread1.ActiveSheetView.DataModel = dataModel; 
dataModel.DataSource = ds; 
dataModel.AddUnboundRows(1, 2); 
name.Rows.Add(new object[] {"Jane", "Simpson"}); 
dataModel.AddRowToDataSource(2, false);
Visual BasicCopy Code
Dim dataModel As New FarPoint.Web.Spread.Model.DefaultSheetDataModel
Dim ds As New DataSet
Dim name As DataTable
name = ds.Tables.Add("Name")
name.Columns.Add("FirstName", Type.GetType("System.String"))
name.Columns.Add("LastName", Type.GetType("System.String"))
name.Rows.Add(New Object() {"John", "Doe"})
name.Rows.Add(New Object() {"Sally ", "Jones"})
name.Rows.Add(New Object() {"Terry", "Hernandez"})
FpSpread1.ActiveSheetView.DataModel = dataModel
dataModel.DataSource = ds
dataModel.AddUnboundRows(1, 2)
name.Rows.Add(New Object() {"Jane", "Simpson"})
dataModel.AddRowToDataSource(2, False)

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.