0
votes

I apologize if this may sound like an easy fix. I am very new at using VB.Net and DevExpress' library of gridviews and many other wonderful things so far. I'm trying to get more familiar with DevExpress and VB.Net in general. So far, I've been trying to get ASPxGridView with a sorted event to be triggered but it just never comes across the function I have below. It is getting the datatable on page load but it is not triggering and sorting event function I have on here. Let me know if I am doing something wrong.

Here is my front code using DevExpress' ASPxGridView code.

<dx:ASPxGridView runat="server" ID="gdrDataView" ClientInstanceName="gdrDataView" AutoGenerateColumns="false" Styles-AlternatingRow-BackColor="#DDDDDD" OnCustomColumnSort="gdrDataView_CustomColumnSort">
   <Settings GridLines="None" />
   <SettingsPager Position="Top" Mode="ShowPager" PageSize="50"></SettingsPager>
   <Styles SelectedRow-ForeColor="Black" SelectedRow-BackColor="#ffdd99"></Styles>
   <SettingsBehavior AllowSelectByRowClick="true" AllowSelectSingleRowOnly="false" AllowSort="true" />
   <SettingsEditing BatchEditSettings-StartEditAction="Click" BatchEditSettings-ShowConfirmOnLosingChanges="true"></SettingsEditing>
   <Columns>
       <dx:GridViewDataColumn Caption="ID" FieldName="ID" ReadOnly="true">
           <CellStyle HorizontalAlign="Center"></CellStyle>
       </dx:GridViewDataColumn>
       <dx:GridViewDataColumn Caption="EnterBy" FieldName="EnterBy"  ReadOnly="true"></dx:GridViewDataColumn>
       <dx:GridViewDataColumn Caption="EnterDate" FieldName="EnterDate" ReadOnly="true"></dx:GridViewDataColumn>
       <dx:GridViewDataColumn Caption="Contact" FieldName="Contact" ReadOnly="true"></dx:GridViewDataColumn>
       <dx:GridViewDataDateColumn Caption="Start" FieldName="Start" ReadOnly="true">
           <PropertiesDateEdit DisplayFormatString="g"></PropertiesDateEdit>
       </dx:GridViewDataDateColumn>
       <dx:GridViewDataDateColumn Caption="End" FieldName="End" ReadOnly="true">
           <PropertiesDateEdit DisplayFormatString="g"></PropertiesDateEdit>
       </dx:GridViewDataDateColumn>
       <dx:GridViewDataColumn Caption="Status" FieldName="Status" ReadOnly="true"></dx:GridViewDataColumn>
       <dx:GridViewDataColumn Caption="Type" FieldName="Type" ReadOnly="true"></dx:GridViewDataColumn>
       <dx:GridViewDataColumn Caption="Description" FieldName="Description" ReadOnly="true"></dx:GridViewDataColumn>
   </Columns>
</dx:ASPxGridView>

Here is my backend code in VB.

Protected Sub gdrDataView_CustomColumnSort(ByVal sender As Object, ByVal e As CustomColumnSortEventArgs)
    Dim grid As ASPxGridView = TryCast(sender, ASPxGridView)
    Dim test As New DataService.DataService
    Dim data As DataSet
    data = test.GetChanges(ddlType.SelectedValue, CheckDBNull(CType(dtStart.SelectedDate, DateTime), enumObjectType.DateType), CheckDBNull(CType(dtEnd.SelectedDate, DateTime), enumObjectType.DateType))
    grid.DataSource = data.Tables(0)
    grid.DataBind()
End Sub
2

2 Answers

0
votes

You have typo in event name which should be OnCustomColumnSort instead of onOnCustomColumnSort.

<dx:ASPxGridView runat="server" ... OnCustomColumnSort="gdrDataView_CustomColumnSort">

Could you also ensure that AutoEventWireup is true inside ASPX?

<%@ Page ... AutoEventWireup="true" %>
0
votes