asp.net.ph

DataGridSortCommandEventArgs Class

System.Web.UI.WebControls Namespace


Provides data for the SortCommand event of a DataGrid control.

DataGridSortCommandEventArgs Class Members

Collapse   Constructors

Visibility Constructor Parameters
public DataGridSortCommandEventArgs ( Object commandSource , DataGridCommandEventArgs dce )

Collapse   Properties

Visibility Name Value Type Accessibility
public CommandSource Object [ Get ]
public SortExpression String [ Get ]

Remarks

A SortCommand event is raised whenever any of the LinkButton controls used for sorting a DataGrid is clicked.

Information associated with the SortCommand event is summed up in a DataGridSortCommandEventArgs object, that is made accessible to the designated event handler.

This information includes the source of the command and the expression by which to set the order of the data in the grid.

For a list of initial property values for an instance of DataGridSortCommandEventArgs, see the DataGridSortCommandEventArgs constructor.

For more information about handling events, see Web Forms Events Model.

Example

The following example demonstrates how to access the SortExpression property of a DataGridSortCommandEventArgs object, to determine which column the user selected to sort the DataGrid control by.

void sortGrid ( Object src, DataGridSortCommandEventArgs e ) {
   DataView myView = fetchData ( query, "northwind" ).Tables [ 0 ].DefaultView;
   myView.Sort = e.SortExpression;
   myGrid.DataSource = myView;
   myGrid.DataBind ( );
}
  C# VB

 Show me 

See Also

DataGrid   AllowSorting   DataGridSortCommandEventHandler Skip Navigation Links




Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 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 asp.net.ph