Search code examples
asp.netfilteringdevexpressobjectdatasourceaspxgridview

DevExpress AspxGridView filter in ObjectDataSource


Yet another problem with DevExpress AspxGridView :)

The context:

  • One Page
  • In the Page, a custom control
  • In the custom Control, a AspxDropDown
  • The AspxDropDown has a DropDownWindowTemplate
  • In the DropDownItemTemplate, I add a GridView and a paging/sorting/filtering enabled ObjectDataSource
  • When handling the selecting event of the ObjectDataSource, I should set filter parameters for the datasource. There filter parameters should come from the FilterRow of the AspxGridView (preferably using the AspxGridView.FilterExpression property).

The problem: the AspxGridView.FilterExpression property is not set to the proper values (set by the user).

Did anyone find a good implementation of what I'm trying to do here?

Thanks a bunch.

:)


Solution

  • I've finally managed to get around the problem.

    Not a good solution, but, still, a way to work around it.

    So.. The "solution" is to databind the grid on every AfterPerformCallback event.

    void grid_AfterPerformCallback(object sender, ASPxGridViewAfterPerformCallbackEventArgs e)
        {
            ((DevExpress.Web.ASPxGridView.ASPxGridView)sender).DataBind();
        }
    

    As I've said, it's not a good solution.