Click here to Skip to main content
13,591,670 members
Rate this:
Please Sign up or sign in to vote.
See more:
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.

Posted 29-Jan-13 3:22am

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

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

  colName LIKE '%somevalue%'

Like this, even if there is no value, everything will be selected.
31-Jan-13 3:37am
Hello Sandeep

Thanks for your great help..

Yes, the Like clause solved the issue, but I am sending multiple id's in the paramter, So it's not worked correctly with Like clause.

Also I'm using a function which split the values:

Suppose In parameter @p I have '1,2,3' Id's then my function is spliting these id's by
@Split(@p,',') and worked well when I am applying this with "In ( Select * from split(@p,',')).

Please let me know how can use the Like clause also by using this function.

Thanks in Advance.


This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Cookies | Terms of Service
Web01-2016 | 2.8.180618.1 | Last Updated 29 Jan 2013
Copyright © CodeProject, 1999-2018
All Rights Reserved.
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100