GrapeCity MultiRow Windows Forms Documentation
Handling User Click (ButtonCell)

The GcMultiRow.CellContentButtonClick event is fired when a button cell is clicked. You can use the GcMultiRow.CellContentButtonClick event to handle a button cell click.

  • The GcMultiRow.CellContentButtonClick event is not fired if the Enabled property of the button cell is set to False.
  • If the button cell is clicked twice, the GcMultiRow.CellContentDoubleClick event is fired, and the GcMultiRow.CellContentButtonClick event is fired after that.

Using Code

The following code provides information when the button cell placed on the row is clicked.

[VB]

Imports GrapeCity.Win.MultiRow
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim buttonCell1 As New ButtonCell()
buttonCell1.Name = "buttonCell1"
buttonCell1.Value = "buttonCell1"
    Dim template1 As Template = Template.CreateGridTemplate(New Cell() {buttonCell1})
GcMultiRow1.Template = template1
GcMultiRow1.RowCount = 10
End Sub
Private Sub GcMultiRow1_CellContentButtonClick(sender As Object, e As GrapeCity.Win.MultiRow.CellEventArgs) Handles GcMultiRow1.CellContentButtonClick
Dim gcMultiRow As GcMultiRow = TryCast(sender, GcMultiRow)
    If e.Scope = CellScope.Row Then
MessageBox.Show(gcMultiRow(e.RowIndex, e.CellIndex).Name)
End If
End Sub
End Sub

[CS]

using GrapeCity.Win.MultiRow;

private void Form1_Load(object sender, EventArgs e)
{
    ButtonCell buttonCell1 = new ButtonCell();
    buttonCell1.Name = "buttonCell1";
    buttonCell1.Value = "buttonCell1";

    Template template1 = Template.CreateGridTemplate(new Cell[] { buttonCell1 });
    gcMultiRow1.Template = template1;
    gcMultiRow1.RowCount = 10;

    gcMultiRow1.CellContentButtonClick += new EventHandler<CellEventArgs>(gcMultiRow1_CellContentButtonClick);
}

private void gcMultiRow1_CellContentButtonClick(object sender, CellEventArgs e)
{
    GcMultiRow gcMultiRow = sender as GcMultiRow;

    if (e.Scope == CellScope.Row)
    {
        MessageBox.Show(gcMultiRow[e.RowIndex, e.CellIndex].Name);
    }
}
See Also

 

 


Copyright © GrapeCity, inc. All rights reserved.

Support Options