Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > CheckBox Outside DataList & Labels Inside DataList

Reply
Thread Tools

CheckBox Outside DataList & Labels Inside DataList

 
 
rn5a@rediffmail.com
Guest
Posts: n/a
 
      12-24-2006
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.

 
Reply With Quote
 
 
 
 
rn5a@rediffmail.com
Guest
Posts: n/a
 
      12-24-2006
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


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.


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
"pointlabel"-like function for Python: distribute text labels on a2-d scatter plot to avoid overlapping labels C Barrington-Leigh Python 1 09-12-2010 09:58 PM
help with pix inside->outside + dmz->outside + inside->outside->dmz Jack Cisco 0 09-19-2007 01:57 AM
CallForward outside->inside->outside failed after one ring. Yogz Cisco 1 04-16-2007 03:58 PM
inside-outside-inside issue on PIX 506E Dan Rice Cisco 9 02-04-2005 12:04 AM
Entering DataList EditItemTemplate from Outside of the DataList Luis Esteban Valencia ASP .Net 1 01-06-2005 07:32 PM



Advertisments