This is a migrated thread and some comments may be shown as answers.
Error when mixing RadAjaxManager and asp:UpdatePanel using asp:PostBackTrigger
11 Answers 175 Views
This is a migrated thread and some comments may be shown as answers.
Zoe
Top achievements
Rank 2
Zoe asked on 06 Jun 2008, 11:42 AM
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
<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; 
        } 

11 Answers, 1 is accepted

Sort by
0
Pavel
Telerik team
answered on 09 Jun 2008, 12:50 PM
Hi Zoe,

We will need to investigate further whether the functionality of the RadAjaxManager can be changed so that the error is not received in such scenarios. For the time being we can advise you to use RadAjaxManager only and remove any UpdatePanels. This will ensure that no such errors occur.

Kind regards,
Pavel
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Chris
Top achievements
Rank 1
answered on 10 Jun 2008, 03:35 PM
Hi,

I have the same issue as Zoe. 

Zoe, how do you do your work around?  I am interested to know.

Chris
0
bhav2007
Top achievements
Rank 1
answered on 12 Jun 2008, 08:04 PM
I'm also experiencing this problem. The problem with the workaround which Pavel suggested is that the RadAjaxManager does not allow you to specify that a specific control should cause a real post back rather than an ajax request. We need a certain button to cause a real post back because our form contains a RadUpload control, and files cannot be uploaded using an ajax request.

Workarounds are suggested in the RadUpload documentation, but they are undesirable in that they require the use of javascript, which we have not used in any other place on our site, and with which I am not familiar.

I submitted a RadGrid bug a few days ago with a very similiar exception (see support ticket 140452). The Telerik representation said that the problem was related to LINQ. May I suggest that this problem may be LINQ related as well?
0
bhav2007
Top achievements
Rank 1
answered on 12 Jun 2008, 09:32 PM
Correction: After looking at the RadControls source it appears that the problem is not LINQ related. At line 568 in Ajax/RadAjaxControl.cs there is a foreach loop which attempts to cast each of the objects in the UpdatePanel.Triggers list to an AsyncPostBackTrigger.
0
Vlad
Telerik team
answered on 13 Jun 2008, 06:45 AM
Hi guys,

We fixed this problem and the fix will be available in the upcoming service pack next week. You can request latest build via support ticket.

Best wishes,
Vlad
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Zoe
Top achievements
Rank 2
answered on 17 Jun 2008, 10:17 AM
Chris - we didn't have a workaround, except to do what I wanted to use RadAjaxManager for with normal ASP UpdatePanels instead (fortunately it wasn't a complicated scenario).

Vlad - thanks for letting us know about a fix being released - knowing that means we'll revisit using RadAjaxManager at some point in the near future.

Zoë
0
Fiona
Top achievements
Rank 1
answered on 25 Jun 2008, 12:18 PM
Is this service pack available yet please?

I have experienced the same problem with a RadUpload control inside an UpdatePanel using PostBackTrigger which worked fine until a RadAjaxManager was introduced on the master page. Now when my page loads I get the same exception thrown.
0
Konstantin Petkov
Telerik team
answered on 25 Jun 2008, 12:23 PM
Hello Fiona,

Yes, the problem has been officially addressed in the Service Pack 2 of RadControls for ASP.NET AJAX Q1 2008. The official version is labeled 2008.1.619.

Greetings,
Konstantin Petkov
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Fiona
Top achievements
Rank 1
answered on 25 Jun 2008, 02:02 PM
Thanks I have found it now and downloaded it.
0
Baal
Top achievements
Rank 1
answered on 08 Aug 2008, 07:22 PM
I am using the 2008 Q2 build and am still having the same problem. Is the problem fixed only in Q1 updated build? It should be included in the Q2 build as well, shouldn't it?
0
Konstantin Petkov
Telerik team
answered on 11 Aug 2008, 10:36 AM
Hello Baal,

Yes, the fix is included in next versions as well. I just tried the scenario posted by Zoe in this thread but it functions properly on my end.

Do you get the error with the same code posted in this thread or is this a different issue? Please isolate the problem in a sample scenario which we can run locally and replicate the problem. We will get back to you with resolution.

All the best,
Konstantin Petkov
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Ajax
Asked by
Zoe
Top achievements
Rank 2
Answers by
Pavel
Telerik team
Chris
Top achievements
Rank 1
bhav2007
Top achievements
Rank 1
Vlad
Telerik team
Zoe
Top achievements
Rank 2
Fiona
Top achievements
Rank 1
Konstantin Petkov
Telerik team
Baal
Top achievements
Rank 1
Share this question
or