473,698 Members | 2,196 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

OnItemCommand in DataList, how to manipulate controls in Selected Row

I am working with a DataList which consists of dynamically changing
number of rows and static number of columns. There are twelve columns
and each is a singe CheckBox representing a Yes or No value(checked or
not checked). I have a 'Check All' button (using OnItemCommand) for
each row that needs check all of the CheckBoxes in that row so the user
dont have to take the time. I can get the row index but how do I go
about setting the boxes to checked only for this row. I have something
like this:

----------------------------------
Dim dl2item As DataListItem
Dim cb1 As CheckBox
Dim cb2 As CheckBox
Dim cb3 As CheckBox
............
Dim cb12 As CheckBox

** Dont know This Part **
** For this row E.Item.ItemInde x I want all boxes checked**

cb1 = CType(dl2item.F indControl("Che ckBox1"), CheckBox)
cb2 = CType(dl2item.F indControl("Che ckBox2"), CheckBox)
cb3 = CType(dl2item.F indControl("Che ckBox3"), CheckBox)
.............
cb12 = CType(dl2item.F indControl("Che ckBox12"), CheckBox)

cb1.Checked = True
cb2.Checked = True
cb3.Checked = True
.............
cb12.Checked = True
---------------------------------------

Thanks,

Brett

Nov 19 '05 #1
1 1736
try this if it works

Dim j As Integer
For j = 0 To e.Item.Cells.Co unt - 1
For Each cntrl As Control In e.Item.Cells(j) .Controls
If TypeOf cntrl Is System.Web.UI.W ebControls.Chec kBox Then
CType(cntrl, CheckBox).Check ed = True
End If
Next

Next

--
http://pathidotnet.blogspot.com
=====
vInAypAtHi
o__
---_,>/'_------
(_) \(_)
---------------
"bdwgarth" wrote:
I am working with a DataList which consists of dynamically changing
number of rows and static number of columns. There are twelve columns
and each is a singe CheckBox representing a Yes or No value(checked or
not checked). I have a 'Check All' button (using OnItemCommand) for
each row that needs check all of the CheckBoxes in that row so the user
dont have to take the time. I can get the row index but how do I go
about setting the boxes to checked only for this row. I have something
like this:

----------------------------------
Dim dl2item As DataListItem
Dim cb1 As CheckBox
Dim cb2 As CheckBox
Dim cb3 As CheckBox
............
Dim cb12 As CheckBox

** Dont know This Part **
** For this row E.Item.ItemInde x I want all boxes checked**

cb1 = CType(dl2item.F indControl("Che ckBox1"), CheckBox)
cb2 = CType(dl2item.F indControl("Che ckBox2"), CheckBox)
cb3 = CType(dl2item.F indControl("Che ckBox3"), CheckBox)
.............
cb12 = CType(dl2item.F indControl("Che ckBox12"), CheckBox)

cb1.Checked = True
cb2.Checked = True
cb3.Checked = True
.............
cb12.Checked = True
---------------------------------------

Thanks,

Brett

Nov 19 '05 #2

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

Similar topics

1
5665
by: Carl Howarth | last post by:
Hi, I have a check box list within a datalist. Can anybody tell me how I go about accessing the onclick event of these checkbox lists? (using vb.net) Many thanks, Carl Howarth carl.howarth@m-s-solutions.co.uk
4
3086
by: V. Jenks | last post by:
What seems like a simple thing is apparently not so straightforward? I have a datalist. Inside of that datalist is an <itemtemplate> secion which contains other server controls such as a label, a radiobuttonlist, etc. I'm driving myself insane trying to figure out how to get
1
3686
by: DaWoE | last post by:
Hey, I don't get my onItemCommand to fire...Can anyone tell me what i'm doing wrong. Here is the code : <%@ Page Language="VB" Debug="true" %> <%@ import Namespace="System.IO" %> <%@ import Namespace="System.Data" %>
1
3338
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,...
4
4036
by: Patrick.O.Ige | last post by:
I have a CheckBoxList in a DataList and i'm trying to get item Selected after doing a postBack. I have set my CheckBoxlist AutoPostBack="True" Any ideas what 'm doing wrong? It seems not to work:( Thanks My CheckBoxList in the DataList Below
1
11942
by: Gary Frank | last post by:
I added a couple of labels and a button to a Datalist control called "dlSignIn" by adding them to the Item template. The labels are bound to a dataset column. Program code gets executed in the dlSignIn_SelectedIndexChanged subroutine when I click the button in the datalist. And the dlSignIn.SelectedIndex property has the correct index for the Datalist row that was selected. Now I would like to access the values in the labels of that...
0
3941
by: Isz | last post by:
PROBLEM: This problem is related to the postback and handling events correctly. BACKGROUND: I have a datalist which acts as a tabbes list with horizontal layout. This datalist is bound to a strogly typed collection I called TabCollection which is a collevtion of items called tab. Each tab is as follows:
2
1924
by: Jim in Arizona | last post by:
I've found that the datalist parameter OnItemCommand will fire regardless of what button (or link) you press within a datalist item, even if that button is already referred to one of the other Command events (OnEditCommand, OnCancelCommand, OnUpdateCommand, and OnDeleteCommand). I was hoping to be able to add a half dozen or so buttons on each datalist item that is displayed, but the only options available are the OnEditCommand,...
0
2431
by: rn5a | last post by:
The OnItemCommand in a DataList is raised whenever a Button is clicked in the DataList. Assume that a DataList displays 3 columns & the <HeaderTemplatecontains 3 LinkButtons - one for each column (to sort the DataList). One way of doing this is by raising the OnItemCommand event of the DataList like this: <script runat="server"> Sub SortData(obj As Object, ea As DataListCommandEventArgs) .......... ..........
0
8683
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
8609
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9031
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
8901
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
8871
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
4371
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
4622
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3052
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
2007
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.