| |||||||||||
DataGrid.AllowSorting PropertySystem.Web.UI.WebControls Namespace DataGrid Class Sets or retrieves a value specifying whether sorting is enabled. Syntax
Property ValueThis property accepts or returns only a boolean value: true if sorting is enabled; otherwise, false. Default value is false. RemarksUse the AllowSorting property to specify or determine whether sorting is enabled or disabled in a DataGrid control. When sorting is enabled in a DataGrid using default bound columns, LinkButton controls are rendered in the header section of each column, enabling users to set the order of the data in the grid by the selected column. When a LinkButton in the columns header is clicked, a SortCommand event occurs. It is up to you, though, to provide code to handle this event. The typical logic for the handler is to pass the field or expression to sort by, and then rebind the data to the DataGrid control. ExampleThe following code snippets demonstrate how to specify and code a handler for the SortCommand event to enable sorting in a DataGrid control. The below code shows how to set the AllowSorting property and designate the handler for the SortCommand event at design time. <asp:datagrid id = "myGrid" runat = "server" ... allowsorting onSortCommand = "sortGrid" /> The below shows the typical code for the SortCommand handler.
See Also |
| ||||||||||
Check out related books at Amazon
© 2000-2008 Rey Nuñez All rights reserved.
If you have any question, comment or suggestion
about this site, please send us a note
You can help support aspxtreme