locked
Asynchronous loading of custom user control RRS feed

  • Question

  • Hello all,

    I have 4 custom user controls. Now, I have a web part in which these 4 user controls are loaded.

    Webpart name: Mywebpart

    Custom User controls are : one.ascx , two.ascx, three.ascx and four.ascx

    In the Mywebpart  under  MywebpartUserControl.ascx  I have

    <div class="tab-content">
            <div id="tab1" class="bits-tab bits-tab-active">
               <div class="content-column"><Mywebpart :one runat="server" id="one" /></div>
               <div class="content-column"><Mywebpart  :two runat="server" id="two" /></div>
            </div>

            <div id="tab2" class="tab-content">
                 <Mywebpart :three runat="server" id="three" />
            </div>

            <div id="tab3" class="tab-content">
                <Mywebpart :four runat="server" ID="four" />

            </div>
        </div>

    This Mywebpart is loaded in the wiki page.

    What I want to do:

    I want to load three and four asynchronously. That means, when the site is opened, It should load one and two controls which are in 1st tab. And three and four controls which are part of tab 2 and 3 shall load asynchronously.

    idea is to improve the performance. Please share the knowledge on how can this be approached..!!

    Regards,

    Rakesh.N


    Rakesh murthy


    • Edited by Rakkk Wednesday, August 3, 2016 8:33 AM
    Wednesday, August 3, 2016 8:32 AM

Answers

  • Hi Rakesh,

    A thought is that, when designing the “three” and “four” user control, you can load the content of them asynchronously after other components in the page are loaded with the help of JavaScript.

    By doing this, all the four user controls in this web part will get loading when the page is rendering, however, for the “three” and “four” user control, they will start loading their content only at the specific time you specific in the code behind.

    An alternative I can find is that, with an extra custom web service, we can obtain the markup of the specific user control on the server side, then retrieve the markup from the client and render in browser via JavaScript.

    More details about it:

    http://tech.just4sharing.com/Pages/tech/Loading-custom-web-parts-asynchronously-in-SharePoint-2010.aspx  

    It would also be appreciated if you can keep updating this thread once there any good idea on this topic.

    Best regards,

    Patrick

    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact tnmff@microsoft.com.

    • Proposed as answer by Patrick_Liang Monday, August 8, 2016 6:31 AM
    • Marked as answer by Patrick_Liang Thursday, August 11, 2016 5:54 AM
    Thursday, August 4, 2016 9:19 AM