PC Review


Reply
Thread Tools Rate Thread

Binding multiple CheckBoxList controls to one sqlDataSource

 
 
=?Utf-8?B?TmFt?=
Guest
Posts: n/a
 
      23rd Jun 2006
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

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Question regarding performance when binding multiple controls todatabase gnewsgroup Microsoft ASP .NET 2 12th Feb 2008 01:23 AM
Binding to SqlDataSource that returns multiple datatable =?Utf-8?B?V2ViTWF0cml4?= Microsoft ASP .NET 2 27th Sep 2006 08:04 PM
Binding multiple CheckBoxList controls to one sqlDataSource =?Utf-8?B?TmFt?= Microsoft VB .NET 0 23rd Jun 2006 06:58 PM
Binding a CheckBoxList to an Enum =?Utf-8?B?aGVjc2FuMDc=?= Microsoft ASP .NET 0 11th Jul 2005 10:39 PM
CheckBoxList Data Binding Tom Microsoft ASP .NET 1 28th Nov 2003 12:46 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:54 AM.