Link to home
Start Free TrialLog in
Avatar of MarcGraff
MarcGraffFlag for United States of America

asked on

Load AJAX Controls after page loads in ASP.NET?

I have a page which has several heavy user controls. These controls are on tabs that when the page first loads are hidden. I have seen pages where a piece of the page is loading when the page renders and they stated that they do this with AJAX.

I am relatively new to AJAX but was wondering how this was accomplished?

My theory was that I would create a JavaScript function that would kick off 6 requests using the Microsoft.XMLHTTP or Msxml2.XMLHTTP object and create child pages which render the code and simply pass back and dump the HTML onto the page. Is this the right way to do this? Is there a better way?

I am using the ASP.NET 3.5 framework with VB.NET as my back end.

Thanks so much for any and all assistance!!
Avatar of silemone
silemone
Flag of United States of America image

you could always try to use the aspnet ajax controls...the javascript is already completed for you...

http://www.asp.net/AJAX/AjaxControlToolkit/Samples/Tabs/Tabs.aspx 

also,
updatepanels are what provides partial postbacks...based upon triggers...i
Avatar of MarcGraff

ASKER

Thanks Silemone!

Just a few questions,

Will this allow the controls to kick off after the page has loaded?
Should each user control contain a UpdatePanel with a JavaScript "__doPostBack"?
Thanks Silemone!

I have modified by code behind to read:
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If IsPostBack Then
            More code
        End If
    End Sub

but the "More code" never fires. What have I done wrong?

Thanks!
<asp:UpdatePanel ID="pnlMain" runat="server">
    <ContentTemplate>
        ASP.NET CODE
        <asp:Button id="btnLoad" runat="server" style="visibility:hidden;" />
    </ContentTemplate>
    <Triggers>
        <asp:AsyncPostBackTrigger ControlID="btnLoad" EventName="Unload" />
    </Triggers>
</asp:UpdatePanel>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of silemone
silemone
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial