473,804 Members | 3,732 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

DataList + CheckBox

I have a DataList with a lot of items where the user can select them trough
the CheckBoxes but i don't have idea how to capture these values from the
checkboxes to insert in my DataBase....How to accomplish that ?

--
Please, check my theSpoke:
http://www.thespoke.net/MyBlog/dgroh/MyBlog.aspx
Nov 19 '05 #1
2 2024
You have to iterate through each item in the datalist find the checkbox
control and check if it is selected. assuming your datalist's id is dl and
the checkbox id is controlsid

Dim alSelectedValue s As New ArrayList

For Each item As DataListItem In dl.Items
'check the item isn't a header or footer
If item.itemindex > -1 Then
Dim cb As CheckBox = item.FindContro l("controlsid ")

Dim value As String = cb.Text
Dim checked As Boolean = cb.Checked

If checked Then
alSelectedValue s.Add(value)
End If
End If

Next

good luck jd

"Paperback Writer" wrote:
I have a DataList with a lot of items where the user can select them trough
the CheckBoxes but i don't have idea how to capture these values from the
checkboxes to insert in my DataBase....How to accomplish that ?

--
Please, check my theSpoke:
http://www.thespoke.net/MyBlog/dgroh/MyBlog.aspx

Nov 19 '05 #2
This code is OK only for Datagrid not only for Datalist. I search the way to
access the footer data from outside of dataset event. If u have, pls inform
me.
Kaung Htut Oo
Kh*****@gmail.c om
"london calling" wrote:
You have to iterate through each item in the datalist find the checkbox
control and check if it is selected. assuming your datalist's id is dl and
the checkbox id is controlsid

Dim alSelectedValue s As New ArrayList

For Each item As DataListItem In dl.Items
'check the item isn't a header or footer
If item.itemindex > -1 Then
Dim cb As CheckBox = item.FindContro l("controlsid ")

Dim value As String = cb.Text
Dim checked As Boolean = cb.Checked

If checked Then
alSelectedValue s.Add(value)
End If
End If

Next

good luck jd

"Paperback Writer" wrote:
I have a DataList with a lot of items where the user can select them trough
the CheckBoxes but i don't have idea how to capture these values from the
checkboxes to insert in my DataBase....How to accomplish that ?

--
Please, check my theSpoke:
http://www.thespoke.net/MyBlog/dgroh/MyBlog.aspx

Nov 19 '05 #3

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

Similar topics

1
4710
by: wsyeager36 | last post by:
I have a datagrid inside a datalist. The datalist shows parent info and the datagrid shows the child info for that parent. There is a checkbox on each row of the child datagrid. Also inside the datalist is a radiobuttonlist. When this radiobuttonlist is checked, I would like it to iterate thru each row on the child grid and either select or deselct the checkboxes (which are on each row of the child datagrid). In addition, the user can also check...
1
10932
by: bill yeager | last post by:
I have a datagrid control within a datalist control. When I try and do a "Find" on the control, the object comes back with nothing and then my pgm crashes. I am 100% sure that my datagird inside my datalist has an id of "Datagrid3". dgChild comes back with "Nothing" while debugging. Here is my code in the itemdatabound event for the datalist: <code>
4
5954
by: mahsa | last post by:
my problem dosent solve yet I want to have claa void in onclick of my check bov if I us function setProps ( ) msg.innerText = "llll"; in <datalist> <ItemTemplate><input type="checkbox" id="cbItem" runat="server" onclick="test() value='<%#DataBinder.Eval(Container.DataItem, "PartNo")%>' NAME="cbItem"><%#DataBinder.Eval(Container.DataItem, "PartNo")%><td class='item_content' width='83'><input value=4 maxLength='4' size='4'...
1
3344
by: Glenn Owens | last post by:
Here's the scenario: I have a DataList populated from a datatable sitting inside a fieldset. Each element (row) in the Datalist has the following child controls: asp:checkbox, asp:image, asp:labels. Within the <form>, but outside the fieldset, containing the datatlist, I have a usercontrol (used to collect search criteria) and some asp:button controls (used to initiate actions - ie. retrieve db data, reset user control fields,...
2
1963
by: Vadivel Kumar | last post by:
I have one datalist which contains one item template. In that, iam printing a value taken from the sql table and one check box. Now, the user will select some checkbox and press a button and that will be cached (or stored in session). After storing i.e., after the page refresh, instead of printing the checkbox i have to say "already selected" to stop the user to uncheck. How to do this in asp.net? as far as session storing is concerned...
1
3781
by: VB Programmer | last post by:
Simple: I have a datalist that is holding a bunch of job opportunities. Beside each opp (in the item template) there's a checkbox that says "apply". After the datalist there's a button that say's "process". I want to LOOP through each datalist entry and see if the user checked the check box. Simple. I wrote the code, but the checked value is ALWAYS False. Any ideas? Here's the code...
1
3162
by: SP | last post by:
Hello there, I have a DataList create as below. <asp:DataList ID="dl_Immunpsuppressive_Main" Runat="server" Width="100%"> <ItemTemplate> <table id="Immunpsuppressive_Main" width="100%" border="0"> <tr> <td class="sub" width="50%" colSpan="2">
1
2176
by: rn5a | last post by:
A ASPX page has a DataList control with a few Labels. This page also has a CheckBox which resides OUTSIDE the DataList. By default, this CheckBox is checked. If the CheckBox is checked, then the Labels existing in the DataList should be visible but if the CheckBox is unchecked by the user, the Labels inside the DataList should be made invisible. How do I do this? Note that the AutoPostBack property of the CheckBox has been set to
0
1042
by: AleXmanFree | last post by:
Hi, I have this kind of problem, In my asp.net page i use DataList and user control that is repeated in DataList. This user control has in it a checkbox , so everytime user clicks on checkbox it goes postback. But i cretaed new public static event in my user control class and binding to this event function in my Page (that has in it user control ) and everytime when checkbox checked i call event that itself calls method in Page class....
1
1478
by: rrayfield | last post by:
I create a datalist from a datatable that is created in code on the page. I have all of my values assigned to dropdowns and labels inside the DL and it runs through them. Everything works great BUT I have added a checkbox to Datalist and now want to set visable= false to the items in the datalist of the checkbox is check (on post back of course).. But I cannot find where I should put my code for this. in what function? ...
0
9706
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
10335
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...
0
10082
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
9157
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6854
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
5525
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5652
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4301
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2993
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.