Me.WebDataGrid1.Behaviors.Sorting.SortingClientEvents.ColumnSorting = "WDG1_ColumnSorting" Me.WebDataGrid1.Behaviors.Sorting.SortingClientEvents.ColumnSorted = "WDG1_ColumnSorted"
this.WebDataGrid1.Behaviors.Sorting.SortingClientEvents.ColumnSorting = "WDG1_ColumnSorting"; this.WebDataGrid1.Behaviors.Sorting.SortingClientEvents.ColumnSorted = "WDG1_ColumnSorted";
// The client event ColumnSorting takes two parameters sender and e // sender is the object which is raising the event // e is the SortingEventArgs var index = null; function WDG1_ColumnSorting(sender, e) { var choice; //Gets the column var column = e.get_column(); //Gets the key of the column index = column.get_index(); if (!confirm("Are you sure you want to continue with Sorting?")) //Cancels the 'ColumnSorting' event. e.set_cancel(true); else { var s = prompt("Enter '0' for none,'1' for ascending,'2' for descending : ", choice); if (s == 1) //Sorts the column in the ascending order e.set_sortDirection(1); else if (s == 2) //Sorts the column in the descending order e.set_sortDirection(2); else //Stops taking any kind of sorting action on the column e.set_sortDirection(0); } } // The client event ColumnSorted takes two parameters sender and e // sender is the object which is raising the event // e is the EventArgs function WDG1_ColumnSorted(sender, e) { var wdg = $find("WebDataGrid1"); //Gets the columns collection object var columnsCollection = wdg.get_columns(); //Gets the column from the index var column = columnsCollection.get_column(index); //Gets the key of the column var key = column.get_key(); window.status = "The column with key '" + key + "' is sorted."; }
Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2