Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / December 2007

Tip: Looking for answers? Try searching our database.

Can you add a System.Web.UI.UserControl to AJAX TabPanel?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Mike - 01 Dec 2007 19:41 GMT
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
------------------------------------------------------------------------------
Milosz Skalecki [MCAD] - 01 Dec 2007 23:51 GMT
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
> > ------------------------------------------------------------------------------

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.