Working with GridWeb Double Click Events

Enabling Double Click Events

All types of double click events can be enabled client-side by setting the GridWeb control’s EnableDoubleClickEvent property to true.

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET
// Enabling Double Click events
GridWeb1.EnableDoubleClickEvent = true;

Once double-click events are enabled, it is possible to create event handlers for any double-click events. These event handlers perform specific tasks when a given double-click event is fired.

Handling Double Click Events

To create an event handler in Visual Studio:

  1. Double-click an event in the Events list in the Properties pane.

For this example, we implemented event handlers for various double-click events.

Double Click Cell

The event handler for the CellDoubleClick event provides an argument of the CellEventArgs type, which provides the complete information of the cell that is double-clicked.

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET
// Event Handler for CellDoubleClick event
protected void GridWeb1_CellDoubleClick(object sender, Aspose.Cells.GridWeb.CellEventArgs e)
{
// Displaying the name of the cell (that is double clicked) in GridWeb's Message Box
string msg = "You just clicked <";
msg += "Row: " + (e.Cell.Row + 1) + " Column: " + (e.Cell.Column + 1) + " Cell Name: " + e.Cell.Name + ">";
GridWeb1.Message = msg;
}

Double Click Column Header

The event handler for the ColumnDoubleClick event provides an argument of the RowColumnEventArgs type that provides the index number of the column for the header that was double-clicked and other information.

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET
// Event Handler for ColumnDoubleClick event
protected void GridWeb1_ColumnDoubleClick(object sender, Aspose.Cells.GridWeb.RowColumnEventArgs e)
{
// Displaying the number of the column (whose header is double clicked) in GridWeb's Message Box
string msg = "You just clicked <";
msg += "Column header: " + (e.Num + 1) + ">";
GridWeb1.Message = msg;
}

Double Click Row Header

The event handler for the RowDoubleClick event provides an argument of the RowColumnEventArgs type that provides the index number of the row for the header that was double-clicked and other related information.

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET
// Event Handler for RowDoubleClick event
protected void GridWeb1_RowDoubleClick(object sender, Aspose.Cells.GridWeb.RowColumnEventArgs e)
{
// Displaying the number of the row (whose header is double clicked) in GridWeb's Message Box
string msg = "You just clicked <";
msg += "Row header: " + (e.Num + 1) + ">";
GridWeb1.Message = msg;
}