Help: Using Multiple Checkboxes or Checkboxlist to filter results in a gridview in ASP.NET 2.0 / VS2

F

Faybert

Hello, and Thanks in advance for any light you might shed on my
troubles.

I'm trying to setup a series of checkboxes, or a checkboxlist to
control the results that are shown on a gridview control.

I have a column in my database that hold the current status of the
items in there. If I used a checkboxlist and populate it with my
options, and set the SQL statement on my gridview control to:
"SELECT [DB_ID], [P_Name], [Status], [Stamp] FROM [Patches] WHERE
([Status] = @Status) ORDER BY [Stamp] DESC"

@Status is my checkboxlist control.

It only partially works, if I select only one checkbox, it updates the
page correctly, if I select more than one, only the first one selected
gets shown and the rest are ignored.

I've also tried setting up 5 individual checkbox controls, and changing
my SQL to:
"SELECT [DB_ID], [P_Name], [Status], [Stamp] FROM [Patches] WHERE
Status IN (@Param1, @Param2, @Param3, @Param4, @Param5 ) ORDER BY
[Stamp] DESC"
I've set ConvertEmptyStringToNull on all of these Param's to True and
False. When using the default PropertyName for the Paramater of
Checkbox.checked, I get this error.
"Syntax error converting the varchar value 'mystring' to a column of
data type bit." (I understand why, now, just including what I've done
already)

If I use checkbox.text for the Parameter, it's always active since the
..text property doesn't change dynamically with it being checked or not.


Basically, I have a page that I want users to be able to filter how
much of the page they see by selecting 1 more more checkboxes. Any
suggestions on how I can get this filter up and going?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,820
Latest member
GilbertoA5

Latest Threads

Top