ASP.net DropDownMenu Wildcard

Capodecina
Permabanned
Joined
31 Dec 2003
Posts
5,172
Location
Barrow-In-Furness
How can I wildcard a drop down menu value that is boudn to a GridView?

For example, by default I would want all values to be shown for the following query:

SELECT Codes.*
FROM Codes

WHERE CodeType = (@CodeType) AND CodeOwner = (@CodeOwner)

At the moment it is attached to two DropDownMenus at the top of the page and only works when values have been selected, how can I wildcard the default DropDownMenu values so all results are shown to begin with?

Thanks guys :)
 
It's not working using the % for the value. Unfortunately they are both character fields.

Here's my query:

SELECT Codes.*
FROM Codes

WHERE CodeType = (@CodeType) AND CodeStatus = (@CodeStatus)
 
SELECT Codes.*
FROM Codes

WHERE CodeType = LIKE % + @CodeType AND CodeStatus = (@CodeStatus)

Doesn't like the query, any ideas?
 
Can't get it working, i've tried using %, '' and '' in my drop down menus for the value but it doesn't work.

Here's the query:

SELECT Codes.*
FROM Codes

WHERE (CodeType = @CodeType OR @CodeType = '') AND (CodeOwner = @CodeOwner OR @CodeOwner = '') AND (CodeStatus = @CodeStatus OR @CodeStatus = '')
 
In the drop down menu, for the All field, i've tried leaving the value field empty, setting a value of % or '' and neither work.

ConvertNullToDBNull property for the ObjectDataSource is set to False.
 
Code:
SELECT     tblCodes.*
FROM         tblCodes

WHERE CodeCategory = LIKE '%' + @CodeCategory AND CodeStatus = LIKE '%' + @CodeStatus

Error in WHERE clause near LIKE

:x
 
Back
Top Bottom