Spread ASP.NET 6.0 Product Documentation
ExpandRow Method
See Also  Example Send Feedback
FarPoint.Web.Spread Assembly > FarPoint.Web.Spread Namespace > SheetView Class : ExpandRow Method


row
Row index
expand
True to expand; false to collapse

Glossary Item Box

Expands or collapses the specified row in the hierarchical display.

Syntax

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

Parameters

row
Row index
expand
True to expand; false to collapse

Exceptions

ExceptionDescription
System.ArgumentOutOfRangeException Specified row is out of range; must be between 0 and number of rows

Example

This example binds the spreadsheet to a DataSet, and displays the data in a Hierarchical View. In a button click event expands the first row of the active view and returns the relationship of the first child in the view.
C#Copy Code
DataSetds=NewSystem.Data.DataSet();

PrivatevoidPage_Load(objectsender,System.EventArgse)
{
If(this.IsPostBack)Return;

this.CreateDataSet();
FpSpread1.Sheets[0].DataSource=ds;
FpSpread1.Sheets[0].DataMember="names";
FpSpread1.Sheets[0].AllowSort=True;
FpSpread1.Sheets[0].AlternatingRows[0].ForeColor=Color.Teal;
FpSpread1.Sheets[0].SetColumnWidth(2,150);
FpSpread1.RowHeader.Width=40;
FpSpread1.HierBar.ShowParentRow=True;
FpSpread1.HierBar.ShowWholePath=True;
FpSpread1.HierarchicalView=True;
}

PrivatevoidCreateDataSet()
{
DataTablenames;
DataTablecars;
DataTablecolors;
names=ds.Tables.Add("names");
names.Columns.Add("first");
names.Columns.Add("last");
names.Columns.Add("index");
names.Rows.Add(Newobject[]{"bob","morris",0});
names.Rows.Add(Newobject[]{"sean","morris",1});
names.Rows.Add(Newobject[]{"chris","morris",2});
cars=ds.Tables.Add("cars");
cars.Columns.Add("make");
cars.Columns.Add("model");
cars.Columns.Add("owner");
cars.Rows.Add(Newobject[]{"ford","F-150",0});
cars.Rows.Add(Newobject[]{"ford","Mustang",1});
cars.Rows.Add(Newobject[]{"chevy","Impala",2});
colors=ds.Tables.Add("colors");
colors.Columns.Add("exterior");
colors.Columns.Add("interior");
colors.Columns.Add("owner");
colors.Rows.Add(Newobject[]{"black","gray",0});
colors.Rows.Add(Newobject[]{"red","beige",1});
colors.Rows.Add(Newobject[]{"black","tan",2});
ds.Relations.Add("cars",names.Columns["index"],cars.Columns["owner"]);
ds.Relations.Add("colors",names.Columns["index"],colors.Columns["owner"]);
}

PrivatevoidButton1_Click(objectsender,System.EventArgse)
{
FarPoint.Web.Spread.SheetViewsv=null;
sv=FpSpread1.ActiveSheetView;
sv.ExpandRow(0,True);
ListBox1.Items.Add(sv.GetChildRelation(0));
}
Visual BasicCopy Code
DimdsAsNewSystem.Data.DataSet()

PrivateSubPage_Load(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesMyBase.Load

If(Me.IsPostBack)ThenReturn

CreateDataSet()
FpSpread1.Sheets(0).DataSource=ds
FpSpread1.Sheets(0).DataMember="names"
FpSpread1.Sheets(0).AllowSort=True
FpSpread1.Sheets(0).AlternatingRows(0).ForeColor=Color.Teal
FpSpread1.Sheets(0).SetColumnWidth(2,150)
FpSpread1.RowHeader.Width=40
FpSpread1.HierBar.ShowParentRow=True
FpSpread1.HierBar.ShowWholePath=True
FpSpread1.HierarchicalView=True

EndSub

PrivateSubCreateDataSet()
DimnamesAsDataTable
DimcarsAsDataTable
DimcolorsAsDataTable
names=ds.Tables.Add("names")
names.Columns.Add("first")
names.Columns.Add("last")
names.Columns.Add("index")
names.Rows.Add(NewObject(){"bob","morris",0})
names.Rows.Add(NewObject(){"sean","morris",1})
names.Rows.Add(NewObject(){"chris","morris",2})
cars=ds.Tables.Add("cars")
cars.Columns.Add("make")
cars.Columns.Add("model")
cars.Columns.Add("owner")
cars.Rows.Add(NewObject(){"ford","F-150",0})
cars.Rows.Add(NewObject(){"ford","Mustang",1})
cars.Rows.Add(NewObject(){"chevy","Impala",2})
colors=ds.Tables.Add("colors")
colors.Columns.Add("exterior")
colors.Columns.Add("interior")
colors.Columns.Add("owner")
colors.Rows.Add(NewObject(){"black","gray",0})
colors.Rows.Add(NewObject(){"red","beige",1})
colors.Rows.Add(NewObject(){"black","tan",2})
ds.Relations.Add("cars",names.Columns("index"),cars.Columns("owner"))
ds.Relations.Add("colors",names.Columns("index"),colors.Columns("owner"))
EndSub

PrivateSubButton1_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButton1.Click
DimsvAsFarPoint.Web.Spread.SheetView
sv=FpSpread1.ActiveSheetView
sv.ExpandRow(0,True)
ListBox1.Items.Add(sv.GetChildRelation(0))
EndSub

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.