Losing references in PanelBar on clear of control values

1 posts, 0 answers
  1. Seth
    Seth avatar
    66 posts
    Member since:
    Oct 2009

    Posted 15 Jan 2010 Link to this post

    This is probably not a Telerik problem, but I am hoping that someone in here can help me with this.  I am using the RadPanelBar as a wizard for creating and managing users.  When a user selects to create a new user, I need to clear out all all the controls' values in each of the panels.  So I wrote a recursive function to do it.  It works, but for some reason I lose object references to some things totally unrelated to the controls I have just recursed through.  I also lose the linked events that worked before I ran this function.  Attached is my code that I run.

        Private Sub ClearAllFields(Optional ByRef ParentControl As Control = Nothing)  
            If ParentControl Is Nothing Then 
                For Each oPanel As RadPanelItem In rpbAccountAdmin.Items  
                For Each oControl As Control In ParentControl.Controls  
                    If oControl.HasControls Then 
                    End If 
                    If TypeOf (oControl) Is RadTextBox Then 
                        CType(oControl, RadTextBox).Text = "" 
                    ElseIf TypeOf (oControl) Is RadComboBox Then 
                        CType(oControl, RadComboBox).SelectedIndex = -1  
                    ElseIf TypeOf (oControl) Is TextBox Then 
                        CType(oControl, TextBox).Text = "" 
                    ElseIf TypeOf (oControl) Is DropDownList Then 
                        CType(oControl, DropDownList).SelectedIndex = -1  
                    ElseIf TypeOf (oControl) Is CheckBox Then 
                        Dim oCheckBox As CheckBox = CType(oControl, CheckBox)  
                        Select Case oCheckBox.ID  
                            Case "chkShowImages" 
                                oCheckBox.Checked = True 
                            Case Else 
                                oCheckBox.Checked = False 
                        End Select 
                    End If 
            End If 
        End Sub 
Back to Top