Spread for ASP.NET 13 Product Documentation
FarPoint.Web.Spread Assembly / FarPoint.Web.Spread.Model Namespace / SortIndicator Enumeration
Example Example


In This Topic
    SortIndicator Enumeration
    In This Topic
    Specifies the display of the sort indicator.
    Syntax
    'Declaration
     
    Public Enum SortIndicator 
       Inherits System.Enum
    'Usage
     
    Dim instance As SortIndicator
    public enum SortIndicator : System.Enum 
    Members
    MemberDescription
    AscendingDisplays the ascending sort indicator
    DescendingDisplays the descending sort indicator
    NoneDisplays no sort indicator
    Example
    This example populates the spreadsheet with data and in the SelectedIndexChanged event of a list box the SortIndicator is changed based on the selection.
    private void Page_Load(object sender, System.EventArgs e)
    {
    if(IsPostBack)return;
    
    FpSpread1.ActiveSheetView.ColumnCount = 3;
    FpSpread1.ActiveSheetView.Columns[2].Width = 120;
    FpSpread1.ActiveSheetView.SetColumnLabel(0, 0, "LName");
    FpSpread1.ActiveSheetView.SetColumnLabel(0, 1, "FName");
    FpSpread1.ActiveSheetView.SetColumnLabel(0, 2, "SSN");
    FpSpread1.ActiveSheetView.SetValue(0, 0, "Adams");
    FpSpread1.ActiveSheetView.SetValue(1, 0, "Bjorn");
    FpSpread1.ActiveSheetView.SetValue(2, 0, "Casey");
    FpSpread1.ActiveSheetView.SetValue(0, 1, "Marie");
    FpSpread1.ActiveSheetView.SetValue(1, 1, "Johan");
    FpSpread1.ActiveSheetView.SetValue(2, 1, "Marv");
    FpSpread1.ActiveSheetView.SetValue(0, 2, "243-65-0987");
    FpSpread1.ActiveSheetView.SetValue(1, 2, "246-78-6767");
    FpSpread1.ActiveSheetView.SetValue(2, 2, "223-98-1357");
    ListBox1.Items.Add("None");
    ListBox1.Items.Add("Ascending");
    ListBox1.Items.Add("Descending");
    ListBox1.AutoPostBack = true;
    }
    
    private void ListBox1_SelectedIndexChanged(object sender, System.EventArgs e)
    {
    if(ListBox1.Items[0].Selected)
    {
    FpSpread1.ActiveSheetView.SetColumnSortIndicator(0,FarPoint.Web.Spread.Model.SortIndicator.None);
    FpSpread1.ActiveSheetView.AllowSort = true;
    }
    else if(ListBox1.Items[1].Selected)
    {
    FpSpread1.ActiveSheetView.SetColumnSortIndicator(0,FarPoint.Web.Spread.Model.SortIndicator.Ascending);
    FpSpread1.ActiveSheetView.AllowSort = true;
    }
    else if(ListBox1.Items[2].Selected)
    {
    FpSpread1.ActiveSheetView.SetColumnSortIndicator(0,FarPoint.Web.Spread.Model.SortIndicator.Descending);
    FpSpread1.ActiveSheetView.AllowSort = true;
    }
    }
    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    If(IsPostBack)Then Return
    
    FpSpread1.ActiveSheetView.ColumnCount = 3
    FpSpread1.ActiveSheetView.Columns(2).Width = 120
    FpSpread1.ActiveSheetView.SetColumnLabel(0, 0, "LName")
    FpSpread1.ActiveSheetView.SetColumnLabel(0, 1, "FName")
    FpSpread1.ActiveSheetView.SetColumnLabel(0, 2, "SSN")
    FpSpread1.ActiveSheetView.SetValue(0, 0, "Adams")
    FpSpread1.ActiveSheetView.SetValue(1, 0, "Bjorn")
    FpSpread1.ActiveSheetView.SetValue(2, 0, "Casey")
    FpSpread1.ActiveSheetView.SetValue(0, 1, "Marie")
    FpSpread1.ActiveSheetView.SetValue(1, 1, "Johan")
    FpSpread1.ActiveSheetView.SetValue(2, 1, "Marv")
    FpSpread1.ActiveSheetView.SetValue(0, 2, "243-65-0987")
    FpSpread1.ActiveSheetView.SetValue(1, 2, "246-78-6767")
    FpSpread1.ActiveSheetView.SetValue(2, 2, "223-98-1357")
    ListBox1.Items.Add("None")
    ListBox1.Items.Add("Ascending")
    ListBox1.Items.Add("Descending")
    ListBox1.AutoPostBack = True
    End Sub
    
    Private Sub ListBox1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged
    If ListBox1.Items(0).Selected Then
    FpSpread1.ActiveSheetView.SetColumnSortIndicator(0, FarPoint.Web.Spread.Model.SortIndicator.None)
    FpSpread1.ActiveSheetView.AllowSort = True
    ElseIf ListBox1.Items(1).Selected Then
    FpSpread1.ActiveSheetView.SetColumnSortIndicator(0, FarPoint.Web.Spread.Model.SortIndicator.Ascending)
    FpSpread1.ActiveSheetView.AllowSort = True
    ElseIf ListBox1.Items(2).Selected Then
    FpSpread1.ActiveSheetView.SetColumnSortIndicator(0, FarPoint.Web.Spread.Model.SortIndicator.Descending)
    FpSpread1.ActiveSheetView.AllowSort = True
    End If
    End Sub
    Inheritance Hierarchy

    System.Object
       System.ValueType
          System.Enum
             FarPoint.Web.Spread.Model.SortIndicator

    See Also