I'm trying to automatically "ajaxify" (i.e. having the control only update itself on postback) the WebParts on a aspx-page. The WebPartZone which the WebParts are in is dynamically created in the codebehind and it then loads its WebParts based on a personalization-database (all that is handled by EPiServer's class ZoneLowUiImpact, which inherits from WebPartZone).
The Load-event of the WebPartsZone looks like this:
void webPartsZone_Load(object sender, EventArgs e)
{
foreach (WebPart webPart in ((ZoneLowUiImpact)sender).WebParts)
{
ajaxManager.AjaxSettings.AddAjaxSetting(webPart, webPart, lp);
}
}
The ajaxManager-object is of type RadAjaxManager (from Telerik). However with this code I get the following error: "Cannot directly modify the collection of Web Parts. Instead, use the WebPartManager.AddWebPart() or WebPartManager.DeleteWebPart() method. "
This happens because Telerik is trying to replace the WebPart with an UpdatePanel with the WebPart as the only child-object.
Are there any alternative solution where I could achieve the same thing without modifing the controls-collection of the WebPart?