Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
53 lines (45 sloc) 3.94 KB
<Type Name="DataGridSortCommandEventHandler" FullName="System.Web.UI.WebControls.DataGridSortCommandEventHandler">
<TypeSignature Language="C#" Value="public delegate void DataGridSortCommandEventHandler(object source, DataGridSortCommandEventArgs e);" />
<TypeSignature Language="ILAsm" Value=".class public auto ansi sealed DataGridSortCommandEventHandler extends System.MulticastDelegate" />
<TypeSignature Language="DocId" Value="T:System.Web.UI.WebControls.DataGridSortCommandEventHandler" />
<TypeSignature Language="VB.NET" Value="Public Delegate Sub DataGridSortCommandEventHandler(source As Object, e As DataGridSortCommandEventArgs)" />
<TypeSignature Language="C++ CLI" Value="public delegate void DataGridSortCommandEventHandler(System::Object ^ source, DataGridSortCommandEventArgs ^ e);" />
<TypeSignature Language="F#" Value="type DataGridSortCommandEventHandler = delegate of obj * DataGridSortCommandEventArgs -&gt; unit" />
<AssemblyInfo>
<AssemblyName>System.Web</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Base>
<BaseTypeName>System.Delegate</BaseTypeName>
</Base>
<Parameters>
<Parameter Name="source" Type="System.Object" />
<Parameter Name="e" Type="System.Web.UI.WebControls.DataGridSortCommandEventArgs" />
</Parameters>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Docs>
<param name="source">The source of the event.</param>
<param name="e">A <see cref="T:System.Web.UI.WebControls.DataGridSortCommandEventArgs" /> that contains the event data.</param>
<summary>Represents the method that handles the <see cref="E:System.Web.UI.WebControls.DataGrid.SortCommand" /> event of the <see cref="T:System.Web.UI.WebControls.DataGrid" /> control.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
When sorting is enabled by setting the <xref:System.Web.UI.WebControls.DataGrid.AllowSorting%2A> property of the <xref:System.Web.UI.WebControls.DataGrid> control to `true`, <xref:System.Web.UI.WebControls.LinkButton> controls are rendered in the header of each column. These links allow you to sort the <xref:System.Web.UI.WebControls.DataGrid> control by the selected column. The <xref:System.Web.UI.WebControls.DataGrid.SortCommand> event is raised when a <xref:System.Web.UI.WebControls.LinkButton> control is clicked.
When you create a <xref:System.Web.UI.WebControls.DataGridSortCommandEventHandler> delegate, you identify the method that will handle the event. To associate the event with your event handler, add an instance of the delegate to the event. The event handler is called whenever the event occurs, unless you remove the delegate. For more information about event handler delegates, see [Handling and Raising Events](~/docs/standard/events/index.md).
## Examples
The following code example demonstrates how to specify and code a handler for the <xref:System.Web.UI.WebControls.DataGrid.SortCommand> event to sort a <xref:System.Web.UI.WebControls.DataGrid> control.
[!code-aspx-csharp[DataGridAllowSorting#1](~/samples/snippets/csharp/VS_Snippets_WebNet/DataGridAllowSorting/CS/datagridallowsortingcs.aspx#1)]
[!code-aspx-vb[DataGridAllowSorting#1](~/samples/snippets/visualbasic/VS_Snippets_WebNet/DataGridAllowSorting/VB/datagridallowsortingvb.aspx#1)]
[!code-aspx-csharp[DataGridSortCommand#1](~/samples/snippets/csharp/VS_Snippets_WebNet/DataGridSortCommand/CS/datagridsortcommandcs.aspx#1)]
[!code-aspx-vb[DataGridSortCommand#1](~/samples/snippets/visualbasic/VS_Snippets_WebNet/DataGridSortCommand/VB/datagridsortcommandvb.aspx#1)]
]]></format>
</remarks>
<altmember cref="T:System.Web.UI.WebControls.DataGridSortCommandEventArgs" />
<altmember cref="T:System.Web.UI.WebControls.DataGrid" />
<altmember cref="E:System.Web.UI.WebControls.DataGrid.SortCommand" />
</Docs>
</Type>
You can’t perform that action at this time.