Hi. I'm trying to add a System.Web.UI.UserControl (Not a
System.Web.UI.WebControl) to an asp.net ajax tabpanel.
Unfortunately it doesn't appear that this is possible. This question could
get very detailed, but I'll keep it short. I have a subroutine shown below
which adds a tabpanels to a tabcontainer(Tabs1) based for each object in a
collection. Then for each tabpanel I try to add a usercontrol named
uWebPage. But when the Page_Load event for uWebPage fires I get null
reference exceptions when referencing controls on uWebpage.
Is this situation I'm trying (adding usercontrol to tabpanel) even possible?
Thanks!
------------------------------------------------------------------------------
Dim oNewTab As AjaxControlToolkit.TabPanel
Dim uWebpage As uWebpage
For Each oAssociation As UserVideoAssociation In oAssociations
For Each oWebpage As Webpage In oAssociation.Webpages
oNewTab = New AjaxControlToolkit.TabPanel
uWebpage = New uWebpage
uWebpage.DomainName = oAssociation.DomainName
uWebpage.Webpage = oWebpage.Webpage
oNewTab.Controls.Add(uWebpage)
oNewTab.HeaderText = oWebpage.Webpage
Tabs1.Tabs.Add(oNewTab)
Next
Next
------------------------------------------------------------------------------
Howdy,
Howdy,
Dynamic user controls require a call to LoadControl method instead of
constructor:
For Each oAssociation As UserVideoAssociation In oAssociations
For Each oWebpage As Webpage In oAssociation.Webpages
oNewTab = New AjaxControlToolkit.TabPanel
uWebpage = CType(LoadControl("locationoftheusercontrol"), uWebpage)
uWebpage.DomainName = oAssociation.DomainName
uWebpage.Webpage = oWebpage.Webpage
oNewTab.Controls.Add(uWebpage)
oNewTab.HeaderText = oWebpage.Webpage
Tabs1.Tabs.Add(oNewTab)
Next
Next
Hope this helps

Signature
Milosz
> Hi. I'm trying to add a System.Web.UI.UserControl (Not a
> System.Web.UI.WebControl) to an asp.net ajax tabpanel.
[quoted text clipped - 29 lines]
> Next
> ------------------------------------------------------------------------------
Mike - 02 Dec 2007 01:47 GMT
Awesome! Thank you so much!
> Howdy,
> Howdy,
[quoted text clipped - 53 lines]
> > Next
> > ------------------------------------------------------------------------------