471,337 Members | 992 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,337 software developers and data experts.

Data Binding: GridView & CheckBoxList & SQL

Here is my scenario:

One of my aspx pages has a CheckBoxList (Item1, Item2) and a GridView.
Then I have a database that has the columns Item1 and Item2 (among
others) with the data type bit. What I am trying to do is to only show
the data sets chosen by the user. So for example if the user checks
Item1 in the CheckBoxList then only the datasets that have Item1 set to
True should be listed in the GridView. Here is what I tried:

<asp:CheckBoxList OnSelectedIndexChanged="ItemsIndexChanged
ID="CheckBoxListItems" RepeatColumns="2"
RepeatLayout=Table TextAlign="Right" Runat="server" >

<asp:GridView ID="GridView1" Runat="server"
AutoGenerateColumns="False" AllowSorting="True"
<asp:BoundField HeaderText="Item1" DataField="Item1"
<asp:BoundField HeaderText="Item2" DataField="Item2"

<asp:SqlDataSource ID="SqlDataSourceTssdSecFilling" Runat="server"
SelectCommand="SELECT * FROM [MyTable]
WHERE (([Item1] = @Item1) AND ([Item1] = @Item2))"
ConnectionString="<%$ ConnectionStrings:AppConnectionItems %>"
<asp:ControlParameter Name="Item1"
ControlID="CheckBoxListItems" Type="Boolean"
<asp:ControlParameter Name="Item2"
ControlID="CheckBoxListItems" Type="Boolean"

I just can't get this to work no matter what I set for the two
controlParameters in the SqlDataSource. It works just fine for a
TextBox. Any help is appreciated.


Jul 21 '05 #1
0 5618

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Agi Chen | last post: by
3 posts views Thread by cannontrodder | last post: by
2 posts views Thread by =?Utf-8?B?UGV0ZXI=?= | last post: by
2 posts views Thread by LVP | last post: by
3 posts views Thread by dbuchanan | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.