473,594 Members | 2,651 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Huge number of checkboxes to be populated from database

I have a database with 90-odd true-false values that I need to display
on a webform as checkboxes. There are also some other values (numbers
and text) that need to be displayed.

I'm wondering the best way to do this! Do I need to individually
place and databind 90 checkboxes (and label them!) or is there a
better way? Note, this is 90 values *per row* of the
query...ultimat ely I'd like to be able to page through this data.

Thanks for any help.

Lerch

Nov 17 '05 #1
3 1773
A solution could be a PlaceHolder control.

Suppose that you have the result of your query in a DataReader. You
loop through each field of a row, then you add dynamic checkboxes in
the PlaceHolder. That way you can set the label and the checked value
easily within your query.

Everything is dynamic so you don't have to modify your webform, you
just modify your query instead. Hope this helps!

Matt
On Fri, 01 Aug 2003 18:19:16 -0400, Mike Lerch
<ml************ ****@nycap.rr.c om> wrote:
I have a database with 90-odd true-false values that I need to display
on a webform as checkboxes. There are also some other values (numbers
and text) that need to be displayed.

I'm wondering the best way to do this! Do I need to individually
place and databind 90 checkboxes (and label them!) or is there a
better way? Note, this is 90 values *per row* of the
query...ultima tely I'd like to be able to page through this data.

Thanks for any help.

Lerch


Nov 17 '05 #2

try with CHECKBOXLIST control, u can bind it dataset...
this will might help you.

vrushal
-----Original Message-----
A solution could be a PlaceHolder control.

Suppose that you have the result of your query in a DataReader. Youloop through each field of a row, then you add dynamic checkboxes inthe PlaceHolder. That way you can set the label and the checked valueeasily within your query.

Everything is dynamic so you don't have to modify your webform, youjust modify your query instead. Hope this helps!

Matt
On Fri, 01 Aug 2003 18:19:16 -0400, Mike Lerch
<ml*********** *****@nycap.rr. com> wrote:
I have a database with 90-odd true-false values that I need to displayon a webform as checkboxes. There are also some other values (numbersand text) that need to be displayed.

I'm wondering the best way to do this! Do I need to individuallyplace and databind 90 checkboxes (and label them!) or is there abetter way? Note, this is 90 values *per row* of the
query...ultim ately I'd like to be able to page through this data.
Thanks for any help.

Lerch


.

Nov 17 '05 #3
On Sat, 02 Aug 2003 00:51:58 GMT, Matt <me***@rocks.co m> wrote:
A solution could be a PlaceHolder control.

Suppose that you have the result of your query in a DataReader. You
loop through each field of a row, then you add dynamic checkboxes in
the PlaceHolder. That way you can set the label and the checked value
easily within your query.

Everything is dynamic so you don't have to modify your webform, you
just modify your query instead. Hope this helps!


Thanks for the tip!

What I ended up doing was writing a little helper function to generate
the code for me. We had a table that listed the field name in one
column and the label (the question that was being checked yes or no)
in another, so I queried that and generated all the
<asp:checkbox.. ....></asp:checkbox>, setting their IDs to
"chkFIELDNA ME" and adding 15 to their TOP value. I pasted the output
of that right into the HTML window of the app, and that was it! I
just had to arrange them on the form.

The webform binds all the checkboxes (plus the handful of text boxes)
using this.databind() in the page load event

Here's the bulk of the code for the helper function if anyone wants to
use it!

string outstring="";
string colname="";
foreach(System. Data.DataColumn dc in
dataSet11.Table s["View2"].Columns)
{
toppos+=15;
colname=dc.Colu mnName;
outstring+="<as p:CheckBox id=chk" + colname + "
style=\"Z-INDEX: 107; LEFT: 400px; POSITION: absolute; TOP: " +
toppos.ToString () + "px\" runat=\"server\ " Text=\"" + colname + "\"
Height=\"4px\" Width=\"60px\" Checked='<%# DataBinder.Eval (dataSet11,
\"Tables[VIEW2].DefaultView.[0]." + colname + "\")
%>'></asp:CheckBox>\r \n" ;
}
Nov 17 '05 #4

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

Similar topics

6
1572
by: Anders Søndergaard | last post by:
Hi, I'm trying to process a large filesystem (+20 million files) and keep the directories along with summarized information about the files (sizes, modification times, newest file and the like) in an instance hierarchy in memory. I read the information from a Berkeley Database. I'm keeping it in a Left-Child-Right-Sibling instance structure, that I operate on recursively.
0
3731
by: Frank Collins | last post by:
Can anyone point me to some good examples on the web of using values from dynamically created checkboxes on forms in ASP, particularly relating to INSERTING those values into a SQL or Access database? Basically, I have a form on which I have a series of statements, with 3 checkboxes for each statement - YES, NO, MAYBE. This series of statements is being dynamically populated from a query of a table in Access, called "tblQuestions". In...
8
2822
by: DylanM | last post by:
I have some checkboxes that are generated from the results of a database search. At the moment, the checkboxes are part of a table making up a form. Users are going through the form, clicking the boxes and saving to the database at the end with the 'Submit' command button. Is it possible to save the changes as the checkboxes are clicked? I suppose I'd need to write some dynamic ASP event handling at the same time as creating the checkboxes......
0
1061
by: Patrick Olurotimi Ige | last post by:
I have a Datalist and i want CheckBoxes in it. The Datalist is popluated from the Database. I want to be able to select the checkboxes with the populated Datalist and insert to table. But i want the user to select a checkBox before the ADD button becomes visible if not it would remain false. My question is if i don't have the CheckBoxes in my Datalist would i be able to control the ADD BUTTON in the Datalist? Any ideas?
3
1799
by: GatorBait | last post by:
Hi all, I'm using a datagrid for the first time and I am running into some problems that I hope someone can help me with. I have a datagrid with 18 rows and 5 columns....column 1 is just text and columns 2-5 are checkboxes. Some of the checkboxes have to be invisible, and in some cases some of the checkboxes have be be enabled=false. I have it now so that the entire grid is populated correctly, but I am having an extremely difficult...
2
4452
by: Incolor | last post by:
Hello All! I have to generate a checklist form as an input form in Access. A paper form is taken out in the field and checked yes, no, OR n/a for each item inspected. The problem I am having is this, the form should have a main heading with the date, report no, and inspector. This information should be entered only once in the form, but recorded for each item inspected in the database table. Under the main heading there is another...
1
1094
by: Mark | last post by:
Hi - I'm using asp.net to draw a grid (dates and people) which is populated by checkboxes - each check box represents a day and a person (so for example, I may have 2 weeks showing across the top, with 10 people showing down the side). Currently, if I click on day 1 person 1, and I want to book their time for 2 weeks, I have to manually check 14 checkboxes. Is there a way for me to click on the first checkbox, and then click on the...
3
4257
by: vikas000000a | last post by:
Hi All, I am new to this forum as far as posting a question is concerned, although I have quite frequently visiting this site as a guest. My quertion relates to preforming fast searched in a very large oracle database. This is my company database. I am having two very huge tables containing crores of records. I have to match each record from one table (I'll call it base table from here onwards) to another table which may contain one or more...
0
867
by: sreedhart10 | last post by:
Hi all, I have a datagrid which has been populated by some data from database (sql). The 6 columns are respectively, email_id, Name, weeklyreport1, weeklyreport2 and weeklyreport3, 'Edit column'. I have written the following code under Edit column private void dtgManageMailingLists_EditCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e) { datagrid1.EditItemIndex = e.Item.ItemIndex;
0
7941
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8246
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8368
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8000
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8231
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5404
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3895
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1476
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1205
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.