G
Guest
I run into a problem where an ASP CheckBoxList control disappears after being
added to a controlcollection. (Have not tested this with other Controls ...)
It takes a WebForm with 3 lines of codes to reproduce the behaviour
Create a WebForm with a CheckBoxList and a Linkbutton. Add a few items to
the list, and add the following code to the LinkButton Click event:
Dim MyctrlCollection As ControlCollection
MyctrlCollection = Me.CreateControlCollection()
MyctrlCollection.Add(FindControl("CheckBoxList1"))
See how the CheckBoxList is gone, after clicking the LinkButton. I have no
idea why it is not rendered anymore ... Please can someone explain?
(Viewstate is Enabled!)
If you add it to e.g. an ArrayList, everything works as expected.
added to a controlcollection. (Have not tested this with other Controls ...)
It takes a WebForm with 3 lines of codes to reproduce the behaviour
Create a WebForm with a CheckBoxList and a Linkbutton. Add a few items to
the list, and add the following code to the LinkButton Click event:
Dim MyctrlCollection As ControlCollection
MyctrlCollection = Me.CreateControlCollection()
MyctrlCollection.Add(FindControl("CheckBoxList1"))
See how the CheckBoxList is gone, after clicking the LinkButton. I have no
idea why it is not rendered anymore ... Please can someone explain?
(Viewstate is Enabled!)
If you add it to e.g. an ArrayList, everything works as expected.