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 Objectuc2 = 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.
Hello kal_patel,
Thank you for posting in the Community.
The approach you are using for accessing the usercontrol object is sound, however I would suggest that you operate with indeces in this scenario:
WebTab1.Tabs(0).Controls(0).Controls(0)
If the userControlUrl is set, there is not need to access the template control by its id (and instead of tabIdx the count in the Tab() collection may be checked).
Please let me know if you have any questions.
Hi kal_patel,
Please do not hesitate to contact me if you have any further questions regarding this matter.