In home page of my site i have some custom webparts. so home page is taking much time to load page,I want to load custom webparts asynchronously how can i do this. Does anyone have any idea.
2 Answers
You can find many articles on how to do this. On codeplex there is a solution that gives an example of how to load your webparts asynchonous. Also MSDN there is a nice article that explains how to create Asynchronous Web Parts.
But maybe you can first analyze your page and detect what webpart and why this webpart slowdown the page. One way to do this is using the Developer Dashboard and useSPMonitoredScope in your webpart to detect posible problems.
The Developer Dashboard is an instrumentation framework introduced in Microsoft SharePoint Foundation 2010. Similar in concept to ASP.NET page tracing, it provides diagnostic information that can help a developer or system administrator troubleshoot problems with page components that would otherwise be very difficult to isolate.
We have done this for so many of our custom web parts in our intranet. The steps we follow are given below:
- First we create custom web parts
- Then we added a web service
- The Web Method will return the html mark up of the user control
- Finally, we render the html mark up on the page using Ajax and JQuery.
Please read this article for more details, I have updated with code sample