>ctrlSpecialSpecs specialSpecControl = (ctrlSpecialSpecs)Page.LoadControl("~/ORCSelection/UserControls/ctrlSpecialSpecs.ascx"); > >// Add the Control to the Placeholder >this.holdSpecialSpecs.Controls.Add(specialSpecControl); >>
>mmPlaceHolder defendantHolder = (mmPlaceHolder)this.Page.FindControl("holdDefendant"); >defendantHolder.Controls.Add(defendantDisplay); >>
> <mm:mmPlaceHolder ID="holdDefendant" runat="server" > > </mm:mmPlaceHolder> >>
'***************************************************************************** 'Description: ' Recursively searches for a control with Id property = controlID ' 'Input Parameters: ' Control to search ' controlID to search for ' 'Returned: ' Control or Nothing ' 'Change Log: '2009.12.24 hewbxk Defect 2955 Created ' '***************************************************************************** Public Function FindMyControl(Of T As Web.UI.Control)(ByVal controlToSearch As T, _ ByVal controlID As String) As Control Dim matchingControl As Control = Nothing Try For Each subControl As Control In controlToSearch.Controls If ((Not subControl.ID Is Nothing) AndAlso (subControl.ID.EndsWith(controlID))) Then matchingControl = subControl Exit For Else If (Not matchingControl Is Nothing) Then 'found it Exit For ElseIf subControl.HasControls() Then matchingControl = Me.FindMyControl(subControl, controlID) End If End If Next Catch objEx As Exception Throw Finally FindMyControl = matchingControl End Try End Function