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

Discussion in 'ASP .Net' started by Faybert@gmail.com, Dec 29, 2005.

  1. Guest

    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?
    , Dec 29, 2005
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ratman
    Replies:
    2
    Views:
    1,529
    Ratman
    Jul 4, 2004
  2. Replies:
    0
    Views:
    514
  3. AAJ
    Replies:
    0
    Views:
    612
  4. joebob8000
    Replies:
    0
    Views:
    1,073
    joebob8000
    Dec 4, 2006
  5. Rick C

    Selecting multiple CheckBoxes in a CheckBoxList

    Rick C, Jun 29, 2004, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    346
    Rick C
    Jun 29, 2004
Loading...

Share This Page