Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CheckBoxList (making elements invisible)

Status
Not open for further replies.

SaadGilani

IS-IT--Management
May 30, 2003
2
US
Hello all,
I am new to asp.net. I have a checkboxlist consisting of 5 elements. I want these elements to be visible only when another check box is checked. I have written the following code but I get an error message BC30456 as shown at the very bottom of this post.
Regards,
SaadG.hq@keyence.com

******************************
Sub chkTimingFilter_CheckedChanged(sender As Object, e As EventArgs)

dim i as integer

if chkTimingFilter.checked = true then
chkAllTiming.enabled=true
chkAllTiming.visible=true
for i = 0 to chklTiming.items.count - 1
colored text chklTiming.items(i).visible = true
next
else
chkAllTiming.enabled=false
chkAllTiming.visible=false
for i = 0 to chklTiming.items.count - 1
chklTiming.items(i).visible = false
next

end if
End Sub
**************************************

++++++++++++++++++++++++++++++++++++++++++++++++++++++
ERROR MESSAGE AS APPEARS ON MY BROWSER. I HAVE CUT AND PASTED...

colored text Compiler Error Message: BC30456: 'visible' is not a member of 'System.Web.UI.WebControls.ListItem'.

Source Error:



Line 455: chkAllTiming.visible=true
Line 456: for i = 0 to chklTiming.items.count - 1
Line 457: chklTiming.items(i).visible = true
Line 458: next
Line 459: else


Source File: E:\HRWeb\list22.aspx Line: 457
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 
Try this:

Since when you press any button on the form, it does a round-robin to the server, then the first time the page is loaded, put in the default items. Then in your page load event, put an if page.ispostback then check for the button pressed, and add in the other items.

When you think about it, the server side processing is much easer then client side processing. I hope this did not come to you too late.

-Gary
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top