Spread ASP.NET 6.0 Product Documentation
ButtonCellType Constructor(String,ButtonType)
See Also  Example Send Feedback
FarPoint.Web.Spread Assembly > FarPoint.Web.Spread Namespace > ButtonCellType Class > ButtonCellType Constructor : ButtonCellType Constructor(String,ButtonType)


cmd
String of command to perform when the user clicks the button
type
Button type

Glossary Item Box

Creates a new button cell with the specified command and button type.

Syntax

Visual Basic (Declaration) 
Public Function New( _
   ByVal cmd As String, _
   ByVal type As ButtonType _
)
Visual Basic (Usage)Copy Code
Dim cmd As String
Dim type As ButtonType
 
Dim instance As New ButtonCellType(cmd, type)
C# 
public ButtonCellType( 
   string cmd,
   ButtonType type
)

Parameters

cmd
String of command to perform when the user clicks the button
type
Button type

Example

This example shows the use of this constructor by creating a spreadsheet, setting the first two columns of cells to be button cells and constructing the buttons with a CommandNames of "MyRed" and "MyBlue". (In the ButtonCommand event the CommandNames are queried and the background color of the spreadsheet is changed depending on the CommandName.)
C#Copy Code
FarPoint.Web.Spread.ButtonCellTypebtn=NewFarPoint.Web.Spread.ButtonCellType("MyRed",ButtonType.PushButton);
FarPoint.Web.Spread.ButtonCellTypebtn1=NewFarPoint.Web.Spread.ButtonCellType("MyBlue",ButtonType.PushButton);
FarPoint.Web.Spread.StyleInfostyle=NewFarPoint.Web.Spread.StyleInfo();
FarPoint.Web.Spread.StyleInfostyle1=NewFarPoint.Web.Spread.StyleInfo();
FpSpread1.Sheets[0].ColumnCount=7;
FpSpread1.Sheets[0].RowCount=50;
style.CellType=btn;
style1.CellType=btn1;
FpSpread1.Sheets[0].SetStyleInfo(-1,0,style);
FpSpread1.Sheets[0].SetStyleInfo(-1,1,style1);
PrivatevoidFpSpread1_ButtonCommand(objectsender,FarPoint.Web.Spread.SpreadCommandEventArgse)
{
If(e.CommandName=="MyRed")
{
FpSpread1.Sheets[0].BackColor=Color.Red;
}
ElseIf(e.CommandName=="MyBlue")
{
FpSpread1.Sheets[0].BackColor=Color.Blue;
}
}
Visual BasicCopy Code
DimbtnAsNewFarPoint.Web.Spread.ButtonCellType("MyRed",ButtonType.PushButton)
Dimbtn1AsNewFarPoint.Web.Spread.ButtonCellType("MyBlue",ButtonType.PushButton)
DimstyleAsNewFarPoint.Web.Spread.StyleInfo()
Dimstyle1AsNewFarPoint.Web.Spread.StyleInfo()
FpSpread1.Sheets(0).ColumnCount=7
FpSpread1.Sheets(0).RowCount=50
style.CellType=btn
style1.CellType=btn1
FpSpread1.Sheets(0).SetStyleInfo(-1,0,style)
FpSpread1.Sheets(0).SetStyleInfo(-1,1,style1)

PrivateSubFpSpread1_ButtonCommand(ByValsenderAsObject,ByValeAsFarPoint.Web.Spread.SpreadCommandEventArgs)HandlesFpSpread1.ButtonCommand
Ife.CommandName="MyRed"Then
FpSpread1.Sheets(0).BackColor=Color.Red
ElseIfe.CommandName="MyBlue"Then
FpSpread1.Sheets(0).BackColor=Color.Blue
EndIf
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.