473,396 Members | 2,003 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,396 software developers and data experts.

ASP.Net Checkbox Problem

Hello,

I am fairly familiar with Web Development with .Net, but i have come
across a problem that is giving me some trouble......

I want to have a list of checkboxes where 1) the labels come from one
table and 2) each box is checked or unchecked according to a different
table.

I have figured out a way to load the checkboxes by using a DataList. I
then put a single Checkbox in the ItemTemplate and bound the text and
checked properties.

My problem is that im not sure how to go about updating the table that
holds the Checked values. I dont know how to access each checkbox in
the DataList.

If someone has a better solution, i am completely open to
suggestions.....Please note i am developing in C#
Thanks,
Matt

Feb 15 '07 #1
2 1587
On Feb 15, 2:32 am, mschmid...@gmail.com wrote:
Hello,

I am fairly familiar with Web Development with .Net, but i have come
across a problem that is giving me some trouble......

I want to have a list of checkboxes where 1) the labels come from one
table and 2) each box is checked or unchecked according to a different
table.

I have figured out a way to load the checkboxes by using a DataList. I
then put a single Checkbox in the ItemTemplate and bound the text and
checked properties.

My problem is that im not sure how to go about updating the table that
holds the Checked values. I dont know how to access each checkbox in
the DataList.

If someone has a better solution, i am completely open to
suggestions.....Please note i am developing in C#
while( myDataReader.read() )
{
CheckBox x = new CheckBox();
x.Text = myDataReader["name"].ToString();
x.Checked = (bool)myDataReader["checked"];
Page.Controls.Add(x);
}

Then further up in your code populate your DataReader object according
to some inner join... e.g.:
"select * from x, y where x.someIdPreferableA_ForreignKey =
y.someOtherIdPreferableA_PrimaryKey"

....

..t

--
http://ajaxwidgets.com
Free ASP.NET Ajax Widgets NOW!

Feb 15 '07 #2
Accessing the CheckBoxes in dataList can be accomplished with

foreach(DataListItem litem in DataList1.Items)
{
CheckBox cb = (CheckBox)litem.FindControl("CheckBox1");
//Process the CB here
}
--
Teemu Keiski
AspInsider, ASP.NET MVP
http://blogs.aspadvice.com/joteke
http://teemukeiski.net

<ms********@gmail.comwrote in message
news:11**********************@a75g2000cwd.googlegr oups.com...
Hello,

I am fairly familiar with Web Development with .Net, but i have come
across a problem that is giving me some trouble......

I want to have a list of checkboxes where 1) the labels come from one
table and 2) each box is checked or unchecked according to a different
table.

I have figured out a way to load the checkboxes by using a DataList. I
then put a single Checkbox in the ItemTemplate and bound the text and
checked properties.

My problem is that im not sure how to go about updating the table that
holds the Checked values. I dont know how to access each checkbox in
the DataList.

If someone has a better solution, i am completely open to
suggestions.....Please note i am developing in C#
Thanks,
Matt
Feb 15 '07 #3

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

Similar topics

1
by: Claire | last post by:
Hello, I am having a problem in my struts application with the checkboxes in my form. I have an array of checkboxes, some of which may be already selected when the form loads. My problem is when...
2
by: Tomas Vera | last post by:
Hello All, I'm having problems creating a page with dynamic checkboxes in a WebApp. In my app, I need to query a database, then (based on results) add checkboxes to my form and set their...
0
by: mike | last post by:
Hi there: I've read an excellent "how to"-article by Microsoft (no. 306227) - partly cited cited at the end of this email). I have implemented the code related to the part "How to Add a...
10
by: Jennyfer J Barco | last post by:
Hello, I have a datagrid that brings some information from a query. I need to have a checkbox in each row so the user can select the rows he wants to reprint. Is it possible to have a checkbox...
4
by: SJ | last post by:
Hi all, I have come across a weird problem when attempting to automatically set the focus in a vb.net form to a checkbox control... In my form I have (on a tab page in a tab control) several...
1
by: spolsky | last post by:
try the the following code with Opera 9.01 (Windows). when clicked slightly faster than normal clicking, the toggler checkbox and other checkboxes displays differently although event method works...
9
by: morellik | last post by:
Dear all, I have a program that creates dinamically a web page. In the page I have the following function to check how many checkbox are checked. function tarInfo(info) { var i=0; var c=0;...
0
by: cyberdawg999 | last post by:
Greetings all in ASP land I have overcome one obstacle that took me 2 weeks to overcome and I did it!!!!! I am so elated!! thank you to all who invested their time and energy towards helping me...
3
by: Mahathi | last post by:
Hi I have a small problem in maintaining the state of a check box. Please do me a favour by telling me the procedure how to do that. My requirement is that "I have to map some roles with...
4
by: Charlotte | last post by:
Hi, I have a problem with a ASP-script, can somewone help me ? here is what I've got: mypage.asp : .... code ... <%
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.