Bug Report B143899
Visible to All Users

ASPxGridView - A dynamically setting datasource issues with filtering and grouping

created 15 years ago

I have created a form that uses an ASPxGridView. The datasource for the gridview is set dynaimcally based on the table selected by the user. There are 2 separate issues I have found when dynamically setting the datasource properties.
Some of the tables have in excess of 20 million records, so it is important that apply filters directly on the datasource, and i need the filter expression from the ASPxGridView to send to the datasourceobject.
Issue 1
The first problem is that any changes to the Filters do not seem to apply to the GridViews FilterExpression property until well after the expression is useful. It is available in the ProcessColumnAutoFilter event but only when it is initially set, if you clear the filter field or remove all filters, the filter expression still contains the previous expression, even inside the ProcessColumnAutoFilter event. In fact I have wired into every event exposed by the gridview and i never see the FilterExpression property get cleared. Since the filter expression doesn't get cleared I am unable to tell that the filter has been removed and my datasource continues to retrieve a filtered dataset. In addition all of this happens after the grid has been databound which is too late to make it useful anyway unless you want to accept the overhead of binding your gridview twice on each callback. Is there any way to determine the actual filters that are applied when they are useful to the user, somewhere in the page load or anywhere before the databinding of the grid?
Issue 2, when setting the datasource dynamically, I group the records, by any of the selected fields, when I attempt to expand the group the grid resets. I am sure this has to do with my rebinding of the grid inside PageLoad but as far as i can tell, there is no way to determine if the callback is from a grouping command or not, so i have no indicator to help me determine if the grid needs to be rebound. I could use some direction on this issue.
Steps to Reproduce:
Issue 1
Part 1) Set a breakpoint inside any event that occurs before the gridview gets bound. Apply a filter to the gridview (I use the category name field in the categories table) when reaching your breakpoint, view the gridviews filter expression and you can see it does not get updated with the applied filter.
Part 2) Apply a filter, Remove the filter. Set a breakpoint anywhere during the callback that occurs when clearing the filter, at no point during the page cycle of the callback does the filter expression show that the filter has been removed

Show previous comments (12)
Stan (DevExpress Support) 15 years ago

    Hi Aaron,
    First, please accept my apologies for the delay in answering. I need some additional time to research the problem. I'll do my best to give you a solution soon.
    Thanks,
    Plato

    DevExpress Support Team 15 years ago

      Hi Aaron,
      Your code does not work properly because you call the DataBind method too early. The FilterExpression becomes available when the ICallbackEventHandler.RaiseCallbackEvent method is called and this happens later than the Page_Load. I have changed your code slightly, and now the ASPxGridView contains the correct FilterExpression within BeforePerformDataSelect event handler.
      I should also mention that the AccessDataSource.FilterExpression is applied on the web server and it is not passed to the DB server…
      Thanks,
      Plato

      ?
      Unknown 15 years ago

        You guys rock!!! I was able to integrate your modifications into my production application. Thank you very much for taking the time to resolve help me with this issue.

        Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

        Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.