473,795 Members | 2,452 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2173
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_CheckChang ed(ByVal obj As Object, ByVal ea As EventArgs)
Dim dlItem As DataListItem

For Each dlItem In DataList1.Items
If (chk1.Checked) Then
dlItem.FindCont rol("Label1").V isible = True
dlItem.FindCont rol("Label2").V isible = True
dlItem.FindCont rol("Label3").V isible = True
Else
dlItem.FindCont rol("Label1").V isible = False
dlItem.FindCont rol("Label2").V isible = False
dlItem.FindCont rol("Label3").V isible = 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
2322
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 have a checkbox bound to that column (bit in SQL Server). I have tried everything and can't see a way to do this without createing an event handler for DataBind() of the CheckBox control. Surely there has to be a better way (and please don't...
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
3343
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,...
0
982
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. My record is big so only one record will be displayed in my datalist at one time. In order to mave more control over how everthing shows up, I was thinking of surrounding the DataList with a HTML <Table>. Do I just stick the the DataList into a...
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...
2
2024
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 accomplish that ? -- Please, check my theSpoke: http://www.thespoke.net/MyBlog/dgroh/MyBlog.aspx
2
1629
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 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
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? ...
4
2204
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 of its other objects , as a certain color or css style <HeaderStyle BackColor="<%= ssponcont %>"</HeaderStyle> ....doesnot work as a Parser error renders: Content ('<HeaderStyle
0
9672
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
9519
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
10214
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
10164
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
10001
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
5437
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...
1
4113
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
2
3723
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2920
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.