I have a WEB page which I want a user to select a "Group" from a drop down box. If the user selects "Show all" I want it to show all items. If they select something else I want it to filter for that in the Where clause.
here is what I have so far. The reason I am not doing this in code is I'm using ASP.NET and the Datagrid is bound to a SQL Datasource.
this is the code that drives the drop down, if anyone is interested.
Or any other suggestions welcome
TIA
DougP
here is what I have so far. The reason I am not doing this in code is I'm using ASP.NET and the Datagrid is bound to a SQL Datasource.
Code:
SELECT Name, Description, [Group], nearby, Latitude, Longitude,
DateAdded, UniqueID, CastType, Price, LocationGroup FROM RenFest
WHERE
CASE When [Group] ='Show All' Then
[Name] = -- DON'T KNOW WHAT TO PUT HERE?
CASE when [Group] = '%' Then -- ??? HERE IS IF THEY SELECT ANYTHING FROM THE DROP DOWN BOX AND GROUP HAS A VALUE
Name LIKE '%' + @name +'%' OR [Group] LIKE '%' + @Group + '%'
END
Order by [name]
this is the code that drives the drop down, if anyone is interested.
Code:
Select 1 as UniqueID, 'Show All' as [Group] from renfest
Union
Select 2 as UniqueID, [Group] from renfest
Group by UniqueID, [Group]
order by UniqueID
Or any other suggestions welcome
TIA
DougP