What is required?

A web part that utilizes the Asynchronous Web Part framework should consist of the below components:
  •  A Web Part control class that serves as a wrapper for collecting properties, connections
  •  A Web Part UI control class that is responsible for rendering HTML for the web part
    • This control contains all the web part logic
  •  A Web Service that loads the web part UI control and renders its HTML back to the web part
  •  A JavaScript file that defines handlers for interaction between the web part and web service
How does it work?

  1. The web part control acts as a wrapper for collecting properties from either the web part properties pane or editor part and for connections with other web parts.
  2. When the web part loads first, the content container in the web part is loaded with a spinner and the JavaScript handler is registered with the page
  3. The JavaScript method then sends the web part properties and connection data to the web service
  4. The web service loads the web part UI control with the web part properties / connection details
  5. Web Part is then rendered as html
  6. If caching is required to be applied, the control HTML is stored in cache
  7. The result HTML is then loaded into the web part content container



The AsyncWebPart.cs control which acts as the web part wrapper calls the JavaScript method "AsyncWebPartGetData" with all the web part parameters / connection data

The JavaScript method "AsyncWebPartGetData" calls the web service method "GetUIHtml" from web service "AsyncWebPartService" with all the parameters

The Web Service method "GetUIHtml" loads the AsyncWebPartUI control which performs the actual core functionality of the web part.

This method renders the "AsyncWebPartUI" control as Html.

The AsyncWebPartUI control performs the actual core functionality of the web part.

Last edited Sep 18, 2010 at 2:58 AM by cmadala, version 5

Comments

peterga Mar 2, 2011 at 1:56 PM 
I am having a small issue.
That usercontrol that I use, need to cooperate with Page object or Viewstate.
Page is each time null.
Can you tell me another solution how can I get reference to Page object?
Thanks