SF 5.2 and RadAjaxPanel doesn't work with an ASP.NET control
Hi guys,
I am not sure if this is a limitation of the control itself or I may set something wrong.
I am using SF 5.2 and I created a user-control so I can add to the page in SF cms.
I have a master page which I already added RadScriptManager to it.
When I put the RadAjaxPanel, it should not make the control post back to the server, right? But sometimes, when I click on a button, it still do full page post-back.
I noticed, when there's a Telerik control on that page, it works fine. But when there's only ASP.NET controls, it doesn't seem to make the AJAX request.
Could anyone guide me to find the solution on this?
Should I go back to use ASP.NET update panel instead?
Thank you very much in advance ;)
Hello,
Thank you for contacting Telerik Support.
You catched absolutely right the aim of the RadAjaxPanel - ajaxifies all controls inside that normally work with postbacks.. However I am not sure what is the whole scenario that you are working on. Could you please show me your code as well as the button that is posting back from time to time so that I can advise you.
Thank you for your cooperation!
Regards,
Veronica Milcheva
the Telerik team
Hi Veronica,
This is the code I have to show why the radAjaxPanel doesn't work.
<telerik:RadAjaxPanel ID="radAjaxPanel" runat="server" LoadingPanelID="radAjaxLoadingPanel">
<asp:RadioButtonList ID="rblMyOptions" runat="server" AutoPostBack="true" OnSelectedIndexChanged="rblMyOptions_SelectedIndexChanged">
<asp:ListItem Value="Fist" Text="First option" Selected="True" />
<asp:ListItem Value="Second" Text="Second option" />
<asp:ListItem Value="Third" Text="Thris option" />
</asp:RadioButtonList>
<asp:Panel ID="pnlFirst" runat="server">1</asp:Panel>
<asp:Panel ID="pnlSecond" runat="server">2</asp:Panel>
<asp:Panel ID="pnlThird" runat="server">3</asp:Panel>
</telerik:RadAjaxPanel>
and this is the code behide
protected void Page_Load(object sender, EventArgs e)
if (!Page.IsPostBack)
Draw_Option();
protected void rblMyOptions_SelectedIndexChanged(object sender, EventArgs e)
Draw_Option();
protected void Draw_Option()
switch (this.rblMyOptions.SelectedValue)
default:
case "Fist":
this.pnlFirst.Visible = true;
this.pnlSecond.Visible = false;
this.pnlThird.Visible = false;
break;
case "Second":
this.pnlFirst.Visible = false;
this.pnlSecond.Visible = true;
this.pnlThird.Visible = false;
break;
case "Third":
this.pnlFirst.Visible = false;
this.pnlSecond.Visible = false;
this.pnlThird.Visible = true;
break;
Thank you,
Hi,
Thank you for the code provided.
It seems that the code you are using is absolutely correct. Do you reproduce the issue outside of Sitefinity? Also can you try to replace the RadAjaxPanel with RadAjaxManager and test again. Also please note that ajaxifying Controls like RadioButtonList, RadPane, RadDock should be added in the RadAjaxManager settings except as Ajax initiator as UpdatedControls also. This is due to their nature of container controls.
All the best,
Veronica Milcheva
the Telerik team
One of your sentences seems to be confusing.
"Also please note that ajaxifying Controls like RadioButtonList, RadPane, RadDock should be added in the RadAjaxManager settings except as Ajax initiator as UpdatedControls also"
What do you want me to do and how?
thank you.
By the way, when you looked at my code, everything looks ok, right?
Can you replicate this issue at your side? or it works correctly with AJAX post back at your side. Could you clarify this for me? Because when you ask me to change to use RadJaxManager, it sounds like to know that RadAjaxPanel doesn't work in SF. I just want to know why?
Hi,
Please accept my apologies for the misunderstanding.
Please note that I cannot reproduce the issue on my side using RadAjaxPanel neither in Sitefinity nor in a sample page. However as you said that the issue occurs from time to time I assumed that you can try using RadAjaxManager instead of RadAjaxPanel to check whether you'll get the same problem.
As for the sentence in my previous post:
The initiator of an Ajax callback is the RadioButtonList in your scenario. You expect to show/hide panels according to the select radio button. However as the RadioButtonList is a container control - you'll need to add is also in the updated controls as well as an initiator. Here's an example:
<
telerik:RadAjaxManager
ID
=
"RadAjaxManager1"
runat
=
"server"
>
<
AjaxSettings
>
<
telerik:AjaxSetting
AjaxControlID
=
"rblMyOptions"
>
<
UpdatedControls
>
<
telerik:AjaxUpdatedControl
ControlID
=
"pnlFirst"
/>
<
telerik:AjaxUpdatedControl
ControlID
=
"pnlSecond"
/>
<
telerik:AjaxUpdatedControl
ControlID
=
"pnlThird"
/>
<
telerik:AjaxUpdatedControl
ControlID
=
"rblMyOptions"
/>
</
UpdatedControls
>
</
telerik:AjaxSetting
>
</
AjaxSettings
>
</
telerik:RadAjaxManager
>
It still does the full post-back after I replaced the new code. Here is the code after I replace RadAjaxPanel with RadAjaxManager.
<
asp:RadioButtonList
ID
=
"rblMyOptions"
runat
=
"server"
AutoPostBack
=
"true"
OnSelectedIndexChanged
=
"rblMyOptions_SelectedIndexChanged"
>
<
asp:ListItem
Value
=
"Fist"
Text
=
"First option"
Selected
=
"True"
/>
<
asp:ListItem
Value
=
"Second"
Text
=
"Second option"
/>
<
asp:ListItem
Value
=
"Third"
Text
=
"Thris option"
/>
</
asp:RadioButtonList
>
<
asp:Panel
ID
=
"pnlFirst"
runat
=
"server"
>1</
asp:Panel
>
<
asp:Panel
ID
=
"pnlSecond"
runat
=
"server"
>2</
asp:Panel
>
<
asp:Panel
ID
=
"pnlThird"
runat
=
"server"
>3</
asp:Panel
>
<
telerik:RadAjaxManager
ID
=
"radAjaxManager"
runat
=
"server"
>
<
AjaxSettings
>
<
telerik:AjaxSetting
AjaxControlID
=
"rblMyOptions"
>
<
UpdatedControls
>
<
telerik:AjaxUpdatedControl
ControlID
=
"pnlFirst"
/>
<
telerik:AjaxUpdatedControl
ControlID
=
"pnlSecond"
/>
<
telerik:AjaxUpdatedControl
ControlID
=
"pnlThird"
/>
<
telerik:AjaxUpdatedControl
ControlID
=
"rblMyOptions"
/>
</
UpdatedControls
>
</
telerik:AjaxSetting
>
</
AjaxSettings
>
</
telerik:RadAjaxManager
>
Hello,
Try to use this example. It should work fine.
Greetings,
Bonny
the Telerik team