473,385 Members | 1,492 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Binding multiple CheckBoxList controls to one sqlDataSource

Nam
I want to use the same sqlDataSource for two CheckBoxList controls in ASP.NET
2.0.
For simplicity, I am using the case of only two CheckBoxList controls in the
following example:

My sqlDataSource is bound to a table in my database. The table has four
columns, say, col1_ID, col1_value and col2_ID, col2_value.

The DataValueField and DataTextField values for CheckBoxList1 are bound to
col1_ID and col1_value respectively. And, for CheckBoxList2, the
DataValueField and DataTextField values are bound to col2_ID, col2_value
columns respectively.

Suppose the data in myTable looks as follows:

Col1_ID Col1_value Col2_ID Col2_value
1 Value11 1 Value21
2 Value12 2 Value22
3 Value13 NULL NULL

When I run my code, the CheckBoxList1 displays the three check boxes, as
expected, with their corresponding values (value11, value12 and value13).
BUT, CheckBoxList2 also display the three check boxes with third check box
having no value.

I do not want a check box to be diplayed if the column has a NULL value. How
can I accomplish this by using only one sqlDataSource?

Since I will be using lots of CheckBoxList controls, I do not want to use
lots of sqlDataSource controls for each CheckBoxList for performance reasons.
Moreover, I want to use only one table with the different pairs of
col_ID,col_value columns in the same table.

Nam

Jun 23 '06 #1
0 1252

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: rob | last post by:
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....
9
by: Timm | last post by:
I have an ASP.NET 2.0 page with two DropDownLists. I am using declarative data binding wherever possible and trying to minimize the use of code. The list of values in DropDownList DDL2 should be...
0
by: Jeppe Jespersen | last post by:
I basically have two controls on my form: A CheckboxList and a GridView. My gridView is bound to a sqlDataSource. In the dataSource's "where" clause, i specify that a parameter should equal the...
0
by: Nam | last post by:
I want to use the same sqlDataSource for two CheckBoxList controls in ASP.NET 2.0. For simplicity, I am using the case of only two CheckBoxList controls in the following example: My...
2
by: WebMatrix | last post by:
Hello, Stored procedure returns results of 3 different queries. On ASP.NET 2.0 page I have a SqlDataSource control with SelectCommand equals this stored procedure name. I want to be able to...
0
by: joebob8000 | last post by:
This seems like a simple task, but my 6 year old roots in classic ASP must be causing me trouble with my current problem. I am looking to provide a search for users in which they can select...
1
by: sheenaa | last post by:
Hello friends, I m using ASP.NET with C# 2005 and SQL SERVER 2005 for the ASP.Net Website. I m using sqldatasource to connect and retrieve the data from database and then it displays the data...
0
by: mutt1170 | last post by:
I have a checkbox list nested inside a gridview. The gridview pulls its data from an objectdatasource and lists countries. The nested checkbox list is databound to another object datasource and...
6
by: dbuchanan | last post by:
There are three parts to this 1.) How do I cascade menus? 2.) And, how do I cascade menus with a multi-select CheckBoxList?
3
by: dbuchanan | last post by:
How, at rundime, do I capture the fact that the parametrized query that fills a CheckBoxList results in an empty set. When the dataset is empty the CheckBoxList does not appear. I would like to...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.