Hi,
We have a large web application project which we want to start implementing RadAjaxManager in, due to advantages it has over standard UpdatePanels. Unfortunately we have come across a problem which prevents gradual integration, which is that if the RadAjaxManager is set to update a usercontrol (or a control containing the usercontrol) which itself contains a normal asp UpdatePanel with a PostBackTrigger defined (as opposed to the usual AsyncPostBackTrigger) then you get an error when loading the page Unable to cast object of type 'System.Web.UI.PostBackTrigger' to type 'System.Web.UI.AsyncPostBackTrigger'. It looks like something in the RadAjaxManager might be assuming that all triggers are of the latter type?
I have replicated this problem in a small project (with very contrived examples but they show the error). We can work around the error now we know what the cause is, but it does mean updating quite a lot of pages/controls where PostBackTrigger is already used, whereas we had hoped to avoid a mass change all at once. The application is very large and quite complex so we may just abandon using RadAjaxManager for now, which would be a shame.
I'm posting this because the error message was not found by google (frustrating - if anyone else happens to encounter this they'll hopefully find this post now) and there's a chance someone might have a bright idea or tell me the obvious thing that's wrong, or Telerik might fix it/document it :)
Controls/UpdatePanelControl.ascx snippet
Controls/UpdatePanelControl.ascx.cs click event handler
RADAjaxManagerError.aspx snippet
RADAjaxManagerError.aspx.cs click event handler
We have a large web application project which we want to start implementing RadAjaxManager in, due to advantages it has over standard UpdatePanels. Unfortunately we have come across a problem which prevents gradual integration, which is that if the RadAjaxManager is set to update a usercontrol (or a control containing the usercontrol) which itself contains a normal asp UpdatePanel with a PostBackTrigger defined (as opposed to the usual AsyncPostBackTrigger) then you get an error when loading the page Unable to cast object of type 'System.Web.UI.PostBackTrigger' to type 'System.Web.UI.AsyncPostBackTrigger'. It looks like something in the RadAjaxManager might be assuming that all triggers are of the latter type?
I have replicated this problem in a small project (with very contrived examples but they show the error). We can work around the error now we know what the cause is, but it does mean updating quite a lot of pages/controls where PostBackTrigger is already used, whereas we had hoped to avoid a mass change all at once. The application is very large and quite complex so we may just abandon using RadAjaxManager for now, which would be a shame.
I'm posting this because the error message was not found by google (frustrating - if anyone else happens to encounter this they'll hopefully find this post now) and there's a chance someone might have a bright idea or tell me the obvious thing that's wrong, or Telerik might fix it/document it :)
Controls/UpdatePanelControl.ascx snippet
<asp:UpdatePanel ID="UpdatePanel1" runat="server" ChildrenAsTriggers="False" UpdateMode="Conditional"> |
<ContentTemplate> |
<div class="count"> |
<asp:Label ID="lblCount" runat="server" Text="0"></asp:Label> |
<asp:Button ID="btnAdd" runat="server" OnClick="btnAdd_Click" Text="Add" /> |
</div> |
</ContentTemplate> |
<Triggers> |
<asp:PostBackTrigger ControlID="btnAdd" /> |
</Triggers> |
</asp:UpdatePanel> |
Controls/UpdatePanelControl.ascx.cs click event handler
protected void btnAdd_Click(object sender, EventArgs e) |
{ |
int count; |
if (!int.TryParse(lblCount.Text, out count)) |
count = 1; |
lblCount.Text = (count + 1).ToString(); |
} |
RADAjaxManagerError.aspx snippet
<telerik:RadScriptManager ID="ScriptManagerRad" runat="server"></telerik:RadScriptManager> |
<h1>Header that should be static</h1> |
<asp:Button ID="btnPanel" runat="server" Text="Hide Panel" onclick="btnPanel_Click" /> |
<asp:Panel ID="pnlShowHide" runat="server"> |
<ctl:updatepanelcontrol runat="server" ID="ctlUpdate" /> |
</asp:Panel> |
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server"> |
<AjaxSettings> |
<telerik:AjaxSetting AjaxControlID="btnPanel"> |
<UpdatedControls> |
<telerik:AjaxUpdatedControl ControlID="btnPanel" /> |
<telerik:AjaxUpdatedControl ControlID="pnlShowHide" /> |
</UpdatedControls> |
</telerik:AjaxSetting> |
</AjaxSettings> |
</telerik:RadAjaxManager> |
RADAjaxManagerError.aspx.cs click event handler
protected void btnPanel_Click(object sender, EventArgs e) |
{ |
btnPanel.Text = btnPanel.Text == "Hide Panel" ? "Show Panel" : "Hide Panel"; |
pnlShowHide.Visible = !pnlShowHide.Visible; |
} |