protected void GridWeb1_CellCommand(object sender, Aspose.Cells.GridWeb.CellEventArgs e)
{
// Handles sorting of columns and rows
if (e.Argument.ToString() == "A1")
{
// ExStart:SortTopToBottom
// Sorts Column 1 from top to bottom in descending order
// Cells.Sort(int startRow, int startColumn, int rows, int columns, int index, bool isAsending, bool isCaseSensitive, bool islefttoright);
GridWeb1.WorkSheets[0].Cells.Sort(1, 0, 20, 4, 0, false, true, false);
// ExEnd:SortTopToBottom
}
else if (e.Argument.ToString() == "B1")
{
GridWeb1.WorkSheets[0].Cells.Sort(1, 0, 20, 4, 1, true, true, false);
}
else if (e.Argument.ToString() == "C1")
{
GridWeb1.WorkSheets[0].Cells.Sort(1, 0, 20, 4, 2, false, true, false);
}
else if (e.Argument.ToString() == "D1")
{
GridWeb1.WorkSheets[0].Cells.Sort(1, 0, 20, 4, 3, true, true, false);
}
else if (e.Argument.ToString() == "1A1")
{
// ExStart:SortLeftToRight
// Sorts Row 1 from left to right in ascending order
// Cells.Sort(int startRow, int startColumn, int rows, int columns, int index, bool isAsending, bool isCaseSensitive, bool islefttoright);
GridWeb1.WorkSheets[1].Cells.Sort(0, 1, 4, 7, 0, true, true, true);
// ExEnd:SortLeftToRight
}
else if (e.Argument.ToString() == "1A2")
{
GridWeb1.WorkSheets[1].Cells.Sort(0, 1, 4, 7, 1, true, true, true);
}
else if (e.Argument.ToString() == "1A3")
{
GridWeb1.WorkSheets[1].Cells.Sort(0, 1, 4, 7, 2, true, true, true);
}
else if (e.Argument.ToString() == "1A4")
{
GridWeb1.WorkSheets[1].Cells.Sort(0, 1, 4, 7, 3, true, true, true);
}
}