Hi,
My question is in reference to this forum thread from 2007: http://community.devexpress.com/forums/t/56484.aspx?PageIndex=1
The thread explains that database side paging and filtering is not supported when using an ObjectDataSource to databind a grid. Since this is from over 3 years ago, I really hope this situation has changed. Unfortunately, I have been unable to find any more up to date information on this matter in the documentation.
I'm sure this is a very common scenario, but I need help with the solution…
We have an n-tier architecture with data-access, business logic etc. As such, the GridViews cannot access the database directly, they will instead need to call a method, that will provide a List of business objects. In addition, the amount of data involved means that paging, sorting and any filtering will have to happen within the database and not in the Grid control - Our data access methods have the necessary sorting and filtering parameters to take care of this, it is just a case of getting them wired up to the Grid.
Previously, with the standard .NET GridView, we have used the ObjectDataSource to solve this problem. However, the thread suggests that this method is not supported with the DevExpress Grid!
As stated this is a really common scenario for enterprise level applications, so I am surprised to see that there isn't a demo or example showing this particular set up. Any help you can provide would be much appreciated.
p.s. Due to the constraints of our application architecture, it is not considered acceptable to use the XPO technology.
Many thanks,
Martyn.
ASPxGridView - ObjectDataSource Paging and Filtering
Answers approved by DevExpress Support
Hello Martyn,
Thank you for the question. I am not sure whether filtering works with ObjectDataSource, but if you enable the ASPxGridView.DataSourceForceStandardPaging property, it should work with your business objects for paging and sorting. For example, you can check a sample from the ASPxGridViewExporter - It's impossible to export all the data from the grid, if the DataSourceForceStandardPaging property is set to True report to see how it works.
Our filtration mechanism is more complex than that of asp:GridView. For example, we can filter the same column by several conditions. That is why it will not be possible for us to implement filtration using ObjectDataSource.
UPDATED: Unless I am mistaken, Telerik grid implementation includes standard asp:GridView control which has mentioned features. However, ASPxGridView control is built from scratch without using standard controls, and its data manipulation base code has some interfaces allowing us to have same functionality in all our product lines.
It is not possible to get FilterExpression property before grid data-binding process, however in some scenarios it is possible to do this using an approach from the ASPxGridView - A dynamically setting datasource issues with filtering and grouping report.
But, I did not want to recommend you, but you can examine the following example describing what interface our grid has, and how you can try to implement it: Simple IListServer implementation. I do not suggest you to try to implement this interface completely, since this task is not trivial, and we do not support solutions based on IListServer interface. To tell you the truth, the interface implementation is hard process, you should bother about many concepts. Our grid is very complex, that is why it uses such entangled interface.
Thanks,
Vest
Hi thanks for the reply,
Is there no way to get the filter expression from the grid so that it can somehow be parsed and passed to our data access layer?
This is how the telerik grid works… It has properties for the current page, sorting expression and filter. These properties are all that is needed to be passed to the ObjectDataSource to enable all the functionality.
Thanks.
Martyn,
Unless I am mistaken, Telerik grid implementation includes standard asp:GridView control which has mentioned features. However, ASPxGridView control is built from scratch without using standard controls, and its data manipulation base code has some interfaces allowing us to have same functionality in all our product lines.
It is not possible to get FilterExpression property before grid data-binding process, however in some scenarios it is possible to do this using an approach from the ASPxGridView - A dynamically setting datasource issues with filtering and grouping report.
But, I did not want to recommend you, but you can examine the following example describing what interface our grid has, and how you can try to implement it: Simple IListServer implementation. I do not suggest you to try to implement this interface completely, since this task is not trivial, and we do not support solutions based on IListServer interface. To tell you the truth, the interface implementation is hard process, you should bother about many concepts. Our grid is very complex, that is why it uses such entangled interface.
Thanks,
Vest
Just to add some more info…
Our data access methods generally look something like this:
public List<SomeBusinessObject> GetData(int pageSize, int pageIndex, string sortExp, string filterExp)
{
// Some code…
}
public int GetRecordCount(string filterExp)
{
// Some code…
}
How do we get the ASPxGridView set up to use methods like these for its data, while still retaining filtering, sorting etc…
Thanks.