Spread for ASP.NET 11 Product Documentation
SortColumnCommand Event
Example 


FarPoint.Web.Spread Assembly > FarPoint.Web.Spread Namespace > FpSpread Class : SortColumnCommand Event
Occurs when the user sorts a column.
Syntax
'Declaration
 
Public Event SortColumnCommand As SpreadCommandEventHandler
'Usage
 
Dim instance As FpSpread
Dim handler As SpreadCommandEventHandler
 
AddHandler instance.SortColumnCommand, handler
public event SpreadCommandEventHandler SortColumnCommand
Event Data

The event handler receives an argument of type SpreadCommandEventArgs containing data related to this event. The following SpreadCommandEventArgs properties provide information specific to this event.

PropertyDescription
(Inherited from System.Web.UI.WebControls.CommandEventArgs)
(Inherited from System.Web.UI.WebControls.CommandEventArgs)
Gets the postback data in an array list of values.  
Gets or sets whether the event has been handled.  
Gets the sheet being updated.  
Gets or sets whether the frozen rows should be sorted when the sorting command occurs.  
Remarks

The SheetView AllowSort property must be set to true for this event to be raised. Then users can double-click column header cells to sort the contents of the column. If the column header contains multiple rows, users can double-click any of the column header cells for the column they want to sort and the sorting occurs.

The SpreadCommandEventHandler receives an argument of type SpreadCommandEventArgs containing data related to this event.

Example
This example illustrates the use of the event.
FarPoint.Web.Spread.Column col;
col = FpSpread1.ActiveSheetView.Columns[1];
FpSpread1.ActiveSheetView.Cells[0, 1].Text = "Alignment";
FpSpread1.ActiveSheetView.Cells[1, 1].Text = "CarbAdjust";
FpSpread1.ActiveSheetView.Cells[2, 1].Text = "Brakes";
col.SortIndicator = FarPoint.Web.Spread.Model.SortIndicator.Descending;
FpSpread1.ActiveSheetView.AllowSort = true;

private void FpSpread1SortColumnCommand(object sender, FarPoint.Web.Spread.SpreadCommandEventArgs e) 
{
    TextBox1.Text = "The column sorted was column #" + e.CommandArgument;
}
Dim col As FarPoint.Web.Spread.Column
col = FpSpread1.ActiveSheetView.Columns(1)
FpSpread1.ActiveSheetView.Cells(0, 1).Text = "Alignment"
FpSpread1.ActiveSheetView.Cells(1, 1).Text = "CarbAdjust"
FpSpread1.ActiveSheetView.Cells(2, 1).Text = "Brakes"
col.SortIndicator = FarPoint.Web.Spread.Model.SortIndicator.Descending
FpSpread1.ActiveSheetView.AllowSort = True

Private Sub FpSpread1SortColumnCommand(ByVal sender As Object, ByVal e As FarPoint.Web.Spread.SpreadCommandEventArgs) Handles
FpSpread1.SortColumnCommand
    TextBox1.Text = "The column sorted was column #" & e.CommandArgument
End Sub
See Also