Intersoft WebGrid Documentation
CreateRow Method
See Also  Send Feedback
ISNet.WebUI.WebGrid Namespace > WebGridTable Class : CreateRow Method






Creates a new WebGridRow instance based on the structure of this table.

Syntax

Visual Basic (Declaration) 
Public Function CreateRow() As WebGridRow
Visual Basic (Usage)Copy Code
Dim instance As WebGridTable
Dim value As WebGridRow
 
value = instance.CreateRow()
C# 
public WebGridRow CreateRow()
Delphi 
public function CreateRow(): WebGridRow; 
JScript 
public function CreateRow() : WebGridRow;
Managed Extensions for C++ 
public: WebGridRow* CreateRow(); 
C++/CLI 
public:
WebGridRow^ CreateRow(); 

Example

The sample codes below show you that CreateRow is a new method of WebGridTable class which creates and initializes WebGridCell according to the columns and structures available in WebGridTable. The SetItemData method allows you to easily set an array of string which will be mapped to the cells in WebGridCellCollection respectively. The AddRange method finally perform the addition of the WebGridRow arrays to the WebGridTable.

[C#]

WebGridRow[] rootRows = new WebGridRow[6];

for (int i = 0; i < 6; i++) rootRows[i] = WebGrid1.RootTable.CreateRow();

rootRows[0].Cells.SetItemData(new string[] { "172-32-1176", "White", "Johnson" });                      rootRows[1].Cells.SetItemData(new string[] { "213-46-8915", "Green", "Marjorie" });                     rootRows[2].Cells.SetItemData(new string[] { "238-95-7766", "Carson", "Cheryl" });                      rootRows[3].Cells.SetItemData(new string[] { "267-41-2394", "O'Leary", "Michael" });                    rootRows[4].Cells.SetItemData(new string[] { "274-80-9391", "Straight", "Dean" });                       rootRows[5].Cells.SetItemData(new string[] { "341-22-1782", "Smith", "Meander" });

WebGrid1.RootTable.Rows.AddRange(rootRows);

Remarks

This method creates a new empty WebGridRow object that is associated with this table instance. This method also populates empty WebGridCell objects based on the WebGridColumnCollection in the table.

You can use this method to easily create unbound rows, set their cell data then add the rows to the table.

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

©2012 Intersoft Solutions Corp. All Rights Reserved.