Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
265
Unable to access UserControl added through ContentTabItem.UserControlURL in code behind
posted

When using the UltraWebTab, it was possible to gain access to a tab's UserControl in code behind after setting the UserControlURL value.  However, in using the WebTab and ContentTabItems, this seems impossible.

Through reflection (and the debug panel) it seems the UserControl is the 0-indexed control of the ContentTabItem's TemplateContainer.  However, TemplateContainer is not available at runtime due to its protection level.

Can someone PLEASE show me the magic needed to access a UserControl added to a ContentTabItem via the UserControlUrl property?


For reference, I am able to access it via:

Dim uc2 As New Object
uc2 = Me.tabs.FindControl("tmpl" + CStr(tabIdx)).Controls(0)
If Not IsNothing(uc2) Then
uc2.typeid = row.Item("expressionoperatortypeid")
End If

But that seems REALLY fragile as I have to increment the tabIdx each time I add a new tab.

Parents Reply Children