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.
Can not find control within ContentTabItem when pro grammatically added.
I used previously some controls but its controls is totally exceptional for every programmer and unused controls. So I strongly believe that If We used this controls in web apps, it will burden for us.
Regards
Suday
Hi kal_patel,
Please contact me if you have any further questions regarding this matter.
Hello kal_patel,
Thank you for your reply.
The user control would be named "ctl00" when assigned to the UsetControlUrl. Therefore you may try something similar to:
WebTab1.Tabs.FindTabFromKey("MyTab2").FindControl("ctl00")
Please let me know if this helps.
Petar,
Thanks. Is there _any_ way to reference the contained ASCX by "name" rather than index? It certainly would make the code easier to read.
Regards,
Please do not hesitate to contact me if you have any further questions regarding this matter.