Spread for ASP.NET 7.0 Product Documentation
ButtonCellType Constructor(String)
See Also  Example Support Options
FarPoint.Web.Spread Assembly > FarPoint.Web.Spread Namespace > ButtonCellType Class > ButtonCellType Constructor : ButtonCellType Constructor(String)


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

Glossary Item Box

Creates a new button cell with the specified command.

Syntax

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

Parameters

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

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.ButtonCellType btn = new FarPoint.Web.Spread.ButtonCellType("MyRed");
FarPoint.Web.Spread.ButtonCellType btn1 = new FarPoint.Web.Spread.ButtonCellType("MyBlue");
FarPoint.Web.Spread.StyleInfo style = new FarPoint.Web.Spread.StyleInfo();
FarPoint.Web.Spread.StyleInfo style1 = new FarPoint.Web.Spread.StyleInfo();
FpSpread1.Sheets[0].ColumnCount = 7;
FpSpread1.Sheets[0].RowCount = 50;
btn.ButtonType = FarPoint.Web.Spread.ButtonType.PushButton;
btn1.ButtonType = FarPoint.Web.Spread.ButtonType.PushButton;
btn.CommandName = "MyRed";
btn1.CommandName = "MyBlue";
style.CellType = btn;
style1.CellType = btn1;
FpSpread1.Sheets[0].SetStyleInfo(-1, 0, style);
FpSpread1.Sheets[0].SetStyleInfo(-1, 1, style1);

private void FpSpread1_ButtonCommand(object sender, FarPoint.Web.Spread.SpreadCommandEventArgs e)
{
    if(e.CommandName == "MyRed")
    {
        FpSpread1.BackColor = Color.Red;
    }
    else if(e.CommandName == "MyBlue")
    {
        FpSpread1.BackColor = Color.Blue;
    }
}
Visual BasicCopy Code
Dim btn As New FarPoint.Web.Spread.ButtonCellType("MyRed")
Dim btn1 As New FarPoint.Web.Spread.ButtonCellType("MyBlue")
Dim style As New FarPoint.Web.Spread.StyleInfo()
Dim style1 As New FarPoint.Web.Spread.StyleInfo()
FpSpread1.Sheets(0).ColumnCount = 7
FpSpread1.Sheets(0).RowCount = 50
btn.ButtonType = FarPoint.Web.Spread.ButtonType.PushButton
btn1.ButtonType = FarPoint.Web.Spread.ButtonType.PushButton
btn.CommandName = "MyRed"
btn1.CommandName = "MyBlue"
style.CellType = btn
style1.CellType = btn1
FpSpread1.Sheets(0).SetStyleInfo(-1, 0, style)
FpSpread1.Sheets(0).SetStyleInfo(-1, 1, style1)

Private Sub FpSpread1_ButtonCommand(ByVal sender As Object, ByVal e As FarPoint.Web.Spread.SpreadCommandEventArgs) Handles
FpSpread1.ButtonCommand
    If e.CommandName = "MyRed" Then
        FpSpread1.BackColor = Color.Red
    ElseIf e.CommandName = "MyBlue" Then
        FpSpread1.BackColor = Color.Blue
    End If
End Sub

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.