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

CheckBox Outside DataList & Labels Inside DataList

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
True so that as soon as the CheckBox is checked/unchecked by the user,
the page gets posted & the Labels inside the DataList become
visible/invisible respectively.

Dec 24 '06 #1
1 2130
I figured it out; this is how I did it (just in case if someone else
happens to come across this dilemma....on the CheckedChanged event of
the CheckBox whose ID is "chk1"):

Sub chk1_CheckChanged(ByVal obj As Object, ByVal ea As EventArgs)
Dim dlItem As DataListItem

For Each dlItem In DataList1.Items
If (chk1.Checked) Then
dlItem.FindControl("Label1").Visible = True
dlItem.FindControl("Label2").Visible = True
dlItem.FindControl("Label3").Visible = True
Else
dlItem.FindControl("Label1").Visible = False
dlItem.FindControl("Label2").Visible = False
dlItem.FindControl("Label3").Visible = False
End If
Next
End Sub
rn**@rediffmail.com wrote:
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
True so that as soon as the CheckBox is checked/unchecked by the user,
the page gets posted & the Labels inside the DataList become
visible/invisible respectively.
Dec 24 '06 #2

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

Similar topics

1
by: Bigtoga | last post by:
Okay - I'm going crazy here trying to figure out how to do this - here goes: I have a DataList populated by a DataReader. In the DataReader, a column is present called "IsInCategory". I want to...
4
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"...
1
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,...
0
by: Jim Heavey | last post by:
I am wanting to use the ability to databind a control to a field in a table. In order to do this, I have to use a control like Datagrid or DataList. Given those choices, I choose the DataList. ...
1
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...
2
by: Paperback Writer | last post by:
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...
2
by: mschmidt18 | last post by:
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...
1
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 ...
4
by: .Net Sports | last post by:
I need to dynamically assign a datalist attribute upon a helper function receiving data from a querystring. If a user picks a certain region, i need the datalist to display its back color, or any...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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
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...

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.