Back to Devexpress

ASPxGridViewCustomCallbackEventArgs Class

aspnet-devexpress-dot-web-305bb72c.md

latest4.0 KB
Original Source

ASPxGridViewCustomCallbackEventArgs Class

Provides data for the ASPxGridView.CustomCallback event.

Namespace : DevExpress.Web

Assembly : DevExpress.Web.v25.2.dll

NuGet Package : DevExpress.Web

Declaration

csharp
public class ASPxGridViewCustomCallbackEventArgs :
    ASPxGridCustomCallbackEventArgs
vb
Public Class ASPxGridViewCustomCallbackEventArgs
    Inherits ASPxGridCustomCallbackEventArgs

ASPxGridViewCustomCallbackEventArgs is the data class for the following events:

Remarks

The ASPxGridView.CustomCallback event is raised when a round trip to the server has been initiated. This occurs when the client ASPxClientGridView.PerformCallback method is called.

The ASPxGridViewCustomCallbackEventArgs class provides the ASPxGridCustomCallbackEventArgs.Parameters property that specifies a string containing specific information passed from the client side. You can use this property to recognize different kinds of callbacks for performing various actions on the server side.

Example

csharp
protected void Grid_CustomCallback(object sender, ASPxGridViewCustomCallbackEventArgs e) {
     if(e.Parameters == "ApplyCustomFilter")
          Grid.FilterExpression = "City = 'Bratislava'";
     if(e.Parameters == "ApplyCustomGrouping") { 
          Grid.DataColumns["City"].GroupBy();
          Grid.ExpandAll();
     }
}
vb
Protected Sub Grid_CustomCallback(ByVal sender As Object, ByVal e As ASPxGridViewCustomCallbackEventArgs)
     If e.Parameters = "ApplyCustomFilter" Then
          Grid.FilterExpression = "City = 'Bratislava'"
     End If
     If e.Parameters = "ApplyCustomGrouping" Then
          Grid.DataColumns("City").GroupBy()
          Grid.ExpandAll()
     End If
End Sub
aspx
<script type="text/javascript">
     function onApplyFilterButtonClick(s, e) {
          grid.PerformCallback("ApplyCustomFilter");
     }
     function onApplyGroupingButtonClick(s, e) {
          grid.PerformCallback("ApplyCustomGrouping");
     }
</script>
…

<dx:ASPxGridView ID="Grid" runat="server" KeyFieldName="ID" ClientInstanceName="grid" OnCustomCallback="Grid_CustomCallback">
     <Columns>
          <dx:GridViewDataColumn FieldName="ID" />
          <dx:GridViewDataColumn FieldName="FirstName" />
          <dx:GridViewDataColumn FieldName="LastName" />
          <dx:GridViewDataColumn FieldName="City" />
     </Columns>
</dx:ASPxGridView>

<dx:ASPxButton ID="ApplyFilterButton" runat="server" AutoPostBack="false" UseSubmitBehavior="false" Text="Apply Custom Filter">
     <ClientSideEvents Click="onApplyFilterButtonClick" />
</dx:ASPxButton>

<dx:ASPxButton ID="ApplyGroupingButton" runat="server" AutoPostBack="false" UseSubmitBehavior="false" Text="Apply Custom Grouping">
     <ClientSideEvents Click="onApplyGroupingButtonClick" />
</dx:ASPxButton>

Inheritance

Object EventArgs ASPxGridCustomCallbackEventArgs ASPxGridViewCustomCallbackEventArgs

See Also

ASPxGridViewCustomCallbackEventArgs Members

Grid View

DevExpress.Web Namespace