RadControls for ASP.NET AJAX No matter which control you would chose, the updated via ajax controls would render in a HTML DIV tag which displays by default as a block element. In order to change this behavior RadAjax exposes the following properties:
UpdatePanelsRenderMode - this property can be set to the RadAjaxManager itself to control the render mode for all ajaxified controls. You can have values Block (the default value) and Inline.
CopyASPX
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" UpdatePanelsRenderMode="Inline">
<AjaxSettings>
<telerik:AjaxSetting AjaxControlID="Button1">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="Label1" />
<telerik:AjaxUpdatedControl ControlID="Label2" />
</UpdatedControls>
</telerik:AjaxSetting>
</AjaxSettings>
</telerik:RadAjaxManager>UpdatePanelRenderMode - this property is to be used for a particular AjaxUpdatedControl setting in the RadAjaxManager. Its default value is Block as well and can be changed to Inline.
CopyASPX
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
<AjaxSettings>
<telerik:AjaxSetting AjaxControlID="Button1">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="Label1" UpdatePanelRenderMode="Inline" />
<telerik:AjaxUpdatedControl ControlID="Label2" />
</UpdatedControls>
</telerik:AjaxSetting>
</AjaxSettings>
</telerik:RadAjaxManager>RenderMode - to changed the render mode of controls wrapped in RadAjaxPanel control, set its RenderMode property to Inline or Block (the default value).
CopyASPX
<telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" RenderMode="Inline">
<asp:Button ID="Button1" runat="server" Text="AJAX" />
<asp:Label ID="Label1" runat="server" Text="Label1" />
</telerik:RadAjaxPanel> Caution |
|---|
If one updated control has several initiators and is present in several places in the AjaxSettings, then setting UpdatePanelRenderMode="Inline" at one place will guarantee that the final render mode of the generated update panel is "Inline". The only way to override this is at runtime in AjaxSettingCreated: CopyC# protected void RadAjaxManager1_AjaxSettingCreated(object sender, AjaxSettingCreatedEventArgs e)
{
if (e.Updated.ID == "Label1")
e.UpdatePanel.RenderMode = UpdatePanelRenderMode.Block;
} CopyVB.NET Protected Sub RadAjaxManager1_AjaxSettingCreated(ByVal sender As Object, ByVal e As AjaxSettingCreatedEventArgs)
If e.Updated.ID = "Label1" Then
e.UpdatePanel.RenderMode = UpdatePanelRenderMode.Block
End If
End Sub |
Caution |
|---|
Note that the following scenario is currently unsupported (including the properties for both the RadAjaxManager and per AjaxUpdatedControl): CopyASPX <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" UpdatePanelsRenderMode="Inline">
<AjaxSettings>
<telerik:AjaxSetting AjaxControlID="Button1">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="Label1" UpdatePanelRenderMode="Block" />
<telerik:AjaxUpdatedControl ControlID="Label2" />
</UpdatedControls>
</telerik:AjaxSetting>
</AjaxSettings>
</telerik:RadAjaxManager> |