如何在AspxGridView中实现过滤 [英] How to implement filtering in AspxGridView

查看:95
本文介绍了如何在AspxGridView中实现过滤的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello All,



我在DevExpress AspxGridView中应用过滤。

用于过滤我发送过滤的值代码端并通过这些值过滤sql server 2005中的记录。



现在我的要求是用户可以选择任何值进行过滤意味着假设我有7个控件为用户提供过滤选项,然后用户可以根据所选值自由选择任何控件来过滤数据库。



现在问题出现在我使用并且语句在我的存储过程中的 where 子句中,它没有显示任何字段,因为如果发送了所有数量的参数值,它就会被过滤。

And如果我在Where子句中使用,那么它会显示所有值而不会根据所选值进行过滤。



有人可以推荐我吗?我怎么能解决这个问题。



先谢谢。



问候,解决方案

根据您共享的内容,处理字符串值的方法之一是使用LIKE关键字和通配符%。



  SELECT  
*
FROM
myTable
WHERE
colName LIKE ' %somevalue%'



喜欢这个即使没有价值,也会选择一切。


Hello All,

I am applying filtering in DevExpress AspxGridView.
For filtering I''m sending the values for filtering from code side and filtering the records in sql server 2005 by these values.

Now my requirement is that the user can select any values for filtering means suppose I have 7 controls for giving option to user to filter then user is free to select any of controls to filter database according to selected values.

Now the problem is occurring when I use And statement in my where clause in stored procedure, it''s not displaying any field because it filtered if all number of parameter values are sent.
And if I use Or in Where clause then it''s displayed all values and not filtered according to selected values.

Can anyone suggest me how can I solve this issue.

Thanks in Advance.

Regards,

解决方案

Based on what you have shared, one of the ways to handle string values is to use LIKE keyword along with wild card character %.

SELECT 
 *
FROM
  myTable
WHERE
  colName LIKE '%somevalue%'


Like this, even if there is no value, everything will be selected.


这篇关于如何在AspxGridView中实现过滤的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆