views:

63

answers:

1

How does one stream files, html or custom AJAX responses from web parts?

Our current quick-and-very-dirty solution is to make the web part call the current page with certain query parameters, which the web part checks and instead of performing normal load it writes the required things to output and calls response end.

This sounds bad since SharePoint might load other web parts and execute their code before reaching our web part.

The web part is configured with data source settings which means the streaming context must be specific to the web part so it can acquire the correct data source settings.

A: 

My understanding is that you can pretty much do this in the same manners you would with a normal .Net website.

I have also used the mechanism you have described to provide a webpart JSON response feed per search "term" I provide as a param back to the current page. This is then picked up during the onload and then a switch is used to determine the correct response.

The other obvious means to doing this is to create supporting webservices which you can then register with the ScriptManager you have in your masterpage. Then you can simply configure your custom webpart to call the webservice method to draw the information required. It's usually a case of creating a business object layer with a webservice class for the business object that can be called reliably.

Brian Scott