By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,160 Members | 1,601 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,160 IT Pros & Developers. It's quick & easy.

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

P: n/a
Hello, and Thanks in advance for any light you might shed on my

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

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?

Dec 29 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.