ASPxGridView.IsAllowSort(GridViewColumn) Method
Indicates whether sorting by the specified column is enabled.
Namespace: DevExpress.Web
Assembly: DevExpress.Web.v24.2.dll
Declaration
Parameters
Name | Type | Description |
---|---|---|
column | GridViewColumn | The data column. |
Returns
Type | Description |
---|---|
Boolean |
|
Remarks
ASPxGridView allows you to control sorting at the column (the GridDataColumnSettings.AllowSort property) and control (the ASPxGridBehaviorSettings.AllowSort property) levels.
Call the IsAllowSort
method to get information about the sort availability of the specified column.
For more information on sorting in the grid, refer to the following topic: ASPxGridView - Sort Data.
<dx:ASPxGridView ID="grid" ClientInstanceName="grid" runat="server" KeyFieldName="ProductID"
OnCustomCallback="grid_CustomCallback">
<Columns>
<dx:GridViewDataTextColumn FieldName="ProductName" VisibleIndex="0" />
<%--...--%>
</Columns>
</dx:ASPxGridView>
<br />
<dx:ASPxButton ID="ASPxButton1" runat="server" Text="Disable the sort mode" AutoPostBack="false">
<ClientSideEvents Click="OnClick" />
</dx:ASPxButton>
function OnClick(s, e) {
grid.PerformCallback();
}
protected void grid_CustomCallback(object sender, ASPxGridViewCustomCallbackEventArgs e) {
var column = grid.Columns["ProductName"] as GridViewDataColumn;
if(grid.IsAllowSort(column)) {
column.Settings.AllowSort = DevExpress.Utils.DefaultBoolean.False;
}
}
Protected Sub grid_CustomCallback(ByVal sender As Object, ByVal e As ASPxGridViewCustomCallbackEventArgs)
Dim column = TryCast(grid.Columns("ProductName"), GridViewDataColumn)
If grid.IsAllowSort(column) Then
column.Settings.AllowSort = DevExpress.Utils.DefaultBoolean.[False]
End If
End Sub
See Also