如何拦截 RadGrid 或 ASPxGridView for ASP.Net 上的筛选器?

发布于 2024-12-16 17:01:43 字数 598 浏览 3 评论 0原文

我需要帮助根据独特的过滤要求在 Telerik RadGrid 和 DevExpress ASPxGridView for Asp.Net 之间进行选择。数据存在于非规范化的 Vax 文件中。所有数据访问都是通过 Sql Server 存储过程调用 ODBC Connx 查询平面文件。存储过程参数用于过滤数据。如果没有任何过滤器,就会返回数千条记录。

我已成功在两个测试 ASP.net 页面上显示所有记录,一个使用 DevExpress ASPxGridVIew,另一个使用 Telerik 的 RadGrid。在代码中,我将每个网格数据绑定到返回超过 26,000 行的存储过程。存储过程通过实体框架函数导入来调用,该函数导入填充 IEnumerable,该IEnumerable 成为每个相应网格的数据源。我可以使用两个网格的过滤器功能,并且它们似乎工作得很好。

我的问题是,在应用网格过滤器之前,所有数千行都从存储过程返回。我想拦截网格的过滤器参数并将它们应用于我的存储过程参数。这样,访问的记录就会少得多。

这可以通过第三方网格来完成吗?如果可以,如何实现?

提前致谢。

I need help choosing between Telerik RadGrid and DevExpress ASPxGridView for Asp.Net based on unique filtering requirements. The data lives in denormalized Vax files. All data access is via Sql Server stored procedures calling ODBC Connx queries to the flat files. Stored procedure parameters are used to filter the data. Without any filter thousand of records are returned.

I've successfully displayed all records on two test ASP.net pages, one with DevExpress ASPxGridVIew and the other with Telerik's RadGrid. In code I databind each grid to the stored procedure that returns over 26,000 rows. The sproc is called via an Entity Framework function import that fills an IEnumerable<Customer> which becomes the datasource of each respective grid. I'm able to use the filter features of both grids and they seem to work nicely.

My problem is that before the grid filter is applied all of the thousands of rows are returned from the stored procedure. I'd like to intercept the grid's filter parameters and apply them to my stored procedure parameters. That way far fewer records will be accessed.

Can this be done with either 3rd party grid and if so how?

Thanks in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

自我难过 2024-12-23 17:01:43

看来可以使用 RadFilter 到 RadGrid 来实现。一个示例。

但总的来说,看起来您需要向 ItemCommand 添加一个处理程序,并根据 CommandName 执行适当的过滤器,例如。然后您可以重新绑定数据。

It seems it can be achieved using a RadFilter to the RadGrid. One example here.

But in general, looks like you'd need to add a handler to ItemCommand, and perform the appropriate filter based on the CommandName, for example. You could then just rebind the data.

隐诗 2024-12-23 17:01:43

Rad Filter 还允许您在不直接绑定到另一个控件或数据源的情况下使用它。过滤器可以选择以多种不同的形式提取过滤器表达式(linq 提供程序就是其中之一)。然后,您可以将该表达式应用到您的数据源。我们正在做类似的事情。我们有一个页面,可以使用字段类型和过滤器选项动态创建 rad 过滤器。然后,用户使用 rad 过滤器 UI 根据所需字段创建过滤器,然后我们提取可应用于显示数据的页面上创建的数据表的过滤器表达式。

下面是从过滤器中提取过滤表达式的代码:

var provider = new RadFilterSqlQueryProvider();
provider.ProcessGroup(myRadFilter.RootGroup);

var sqlFilterExpression = provider.Result;

The Rad Filter will also allow you to use it without being directly tied to another control or datasource. The filter has an option to extract a filter expression in many different forms (linq provider is one of them). You can then apply that expression to your datasource. We are doing something similar. We have a page where we dynamically create the rad filter with the types of fields and filter options. The user then uses the rad filter UI to create the filter based on the desired fields, then we extract a filter expression we can apply to a datatable that is created on the page that shows the data.

Here is the code for extracting the filter expression from the filter:

var provider = new RadFilterSqlQueryProvider();
provider.ProcessGroup(myRadFilter.RootGroup);

var sqlFilterExpression = provider.Result;
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文