Kentico CMS 6.0 Developer's Guide

AJAX support

AJAX support

Previous topic Next topic Mail us feedback on this topic!  

AJAX support

Previous topic Next topic JavaScript is required for the print function Mail us feedback on this topic!  

Your web parts can use the UpdatePanel, which wraps the web part into an AJAX UpdatePanel control. This can easily be done by enabling the Use update panel property of any web part.

 

devguide_clip0380

 

No further modifications are necessary, but the following rules should be followed:

 

1. If the web part uses any dynamically loaded controls, their ID must be defined:

 

Incorrect:

 

Control ctrl = this.LoadControl("~/MyControl.ascx");

if (ctrl != null)

{

   Controls.Add(ctrl);

}

 

Correct:

 

Control ctrl = this.LoadControl("~/MyControl.ascx");

if (ctrl != null)

{

   ctrl.ID = "myControl";

   Controls.Add(ctrl);

}

 

2. When requesting PostBackEventReference, use Kentico's custom function instead of the default one:

 

Incorrect:

 

this.Page.ClientScript.GetPostBackEventReference(this, "");

 

Correct:

 

CMS.ExtendedControls.ControlsHelper.GetPostBackEventReference(this, "");