Only items of type Telerik.Web.UI.IRadToolBarButton can initiate postbacks

28 posts, 0 answers
  1. Adam
    Adam avatar
    177 posts
    Member since:
    Oct 2012

    Posted 29 Jul 2008 Link to this post

    We are using the 2008 SP1 version of the Toolbar. For some reason we are getting the message "Only items of type Telerik.Web.UI.IRadToolBarButton can initiate postbacks" when you click on an item in the toolbar that starts a long running operation on the server and then you click the button again after waiting a second or two. The page has not completed its previous postback and for some reason throws this exception if it hasn't finished.

    Any ideas?

    Thanks,
    Adam

  2. Erjan Gavalji
    Admin
    Erjan Gavalji avatar
    1411 posts
    Member since:
    Sep 2012

    Posted 31 Jul 2008 Link to this post

    Hi Adam,

    The problem happens because of the Ajax call not finished. If the long operation changes the RadToolBar structure (or RadToolBar has been dynamically populated), the server-side part of the control receives wrong content. It then tries raising the event from the context of a RadToolBarDropDown, or a RadToolBarItem, or a separator button, hence the error.

    What you can do is disable the buttons during the ajax call and enable them after it. This can be achieved by using the client-side events of RadAjaxManager.

    Best,
    Erjan Gavalji
    the Telerik team


    Check out Telerik Trainer, the state of the art learning tool for Telerik products.

  3. DevCraft Release
  4. Adam
    Adam avatar
    177 posts
    Member since:
    Oct 2012

    Posted 04 Aug 2008 Link to this post

    We're not using a RadAjaxManager on the page at all, so I don't believe that is the issue.

  5. Erjan Gavalji
    Admin
    Erjan Gavalji avatar
    1411 posts
    Member since:
    Sep 2012

    Posted 04 Aug 2008 Link to this post

    Hi Adam,

    Could it be that you have a mix of visible and invisible items? RadToolBar for ASP.NET Ajax had a problem in this case, which could cause that problem. Could you update to the latest version?

    Regards,
    Erjan Gavalji
    the Telerik team


    Check out Telerik Trainer, the state of the art learning tool for Telerik products.

  6. Adam
    Adam avatar
    177 posts
    Member since:
    Oct 2012

    Posted 04 Aug 2008 Link to this post

    I've tried the new version (2008 Q2) and get the same results. We're not doing anything fancy with the toolbar. There is one hidden item that stays hidden the entire time. After the postback, the toolbar is set to be invisible and a new one appears.

    I'm going to try setting a javascript variable if certain toolbar buttons are clicked. If they are then I will set_cancel(true) in the clicking event. This should keep it from being allowed to attempt the postback twice.

  7. Erjan Gavalji
    Admin
    Erjan Gavalji avatar
    1411 posts
    Member since:
    Sep 2012

    Posted 04 Aug 2008 Link to this post

    Hi Adam,

    It occurred that the problem core lies deeper than seemed first. Can you open a formal support ticket and send us a simplified version of the project, demonstrating the problem? We will do our best to find what's wrong and help immediately.

    Kind regards,
    Erjan Gavalji
    the Telerik team


    Check out Telerik Trainer, the state of the art learning tool for Telerik products.

  8. Adam
    Adam avatar
    177 posts
    Member since:
    Oct 2012

    Posted 07 Aug 2008 Link to this post

    I tried to develop a sample application, but unfortunately, I can't build in enough of the items in our application into the sample application to get it to fail, and I'm not able to determine exactly what is causing it to fail to build just those components into the sample app.

    I'm willing to send whatever I can, but it won't be a "working" app due to the objects and database not being in place. I can also send stack traces if they are of any assistance and I would be more than willing to do an Adobe Connect session to demonstrate the error in our environment.

  9. Erjan Gavalji
    Admin
    Erjan Gavalji avatar
    1411 posts
    Member since:
    Sep 2012

    Posted 08 Aug 2008 Link to this post

    Hi Adam,

    Is it possible for you to scale down the application you have? Here is a possible approach:

    • Copy the page (having the problem) to a blank website;
    • Add the required user controls/master pages;
    • Add a local copy of the database the page might use and remove the sensitive information/reduce the information as much as possible;
    • If there are some controls/classes that need classes from another assembly either remove them or create some stub classes so that they let the page work;
    • Start removing controls from the page one by one until the problem is gone. This would mean that the problem lies in the last removed component;
    Having a sample, capable of demonstrating the problem on our side will really help us identify and fix it faster.
    Best regards,
    Erjan Gavalji
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.

  10. Adam
    Adam avatar
    177 posts
    Member since:
    Oct 2012

    Posted 08 Aug 2008 Link to this post

    I tried a shortened version of that. Unfortunately, our database is 60GB (and it would take me forever to find out what is needed and what isn't to support this one page). We have a temporary fix that runs the set_cancel(true) whenever a button has been clicked and the postback hasn't completed.

    I'll try to get something working next week, or pinpoint it in our application and send you the exact line that seems to be the culprit.

  11. Erjan Gavalji
    Admin
    Erjan Gavalji avatar
    1411 posts
    Member since:
    Sep 2012

    Posted 11 Aug 2008 Link to this post

    Hi Adam,

    I'm looking forward to your findings then.

    Best regards,
    Erjan Gavalji
    the Telerik team


    Check out Telerik Trainer, the state of the art learning tool for Telerik products.

  12. Terry Duke
    Terry Duke avatar
    2 posts
    Member since:
    Jul 2008

    Posted 22 Aug 2008 Link to this post

    I  get this error any time I click an a button that has been dynamically created in my tool bar. If I add the same button with the designer it works fine.

    RadToolBarButton EditButton = new RadToolBarButton("Edit", false, "TextStyleBold");

    EditButton.CssClass =

    "ASP_EditBtn";

    RadToolBar1.Items.Add(EditButton);

     

     

    protected void RadToolBar1_ButtonClick(object sender, RadToolBarEventArgs e)

    {

    TestLabel.Text =

    "You Clicked the " + e.Item.Text + " Button";

    }

    }

    }


     

    Server Error in '/' Application.

    Only items of type Telerik.Web.UI.IRadToolBarButton can initiate postbacks

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.InvalidOperationException: Only items of type Telerik.Web.UI.IRadToolBarButton can initiate postbacks

    Source Error:

    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

    Stack Trace:

    [InvalidOperationException: Only items of type Telerik.Web.UI.IRadToolBarButton can initiate postbacks]
       Telerik.Web.UI.RadToolBar.RaisePostBackEvent(String eventArgument) +193
       Telerik.Web.UI.RadToolBar.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7
       System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11
       System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +177
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1746
    


    Version Information: Microsoft .NET Framework Version:2.0.50727.1433; ASP.NET Version:2.0.50727.1433 


    Remove the dynamic code to add the buttons and add this on the page it works

    <Items>

    <telerik:RadToolBarButton runat="server" CssClass="ASP_AddBtn" Text="Add">

    </telerik:RadToolBarButton>

    <telerik:RadToolBarButton runat="server" CssClass="ASP_EditBtn" Text="Edit">

    </telerik:RadToolBarButton>

    </Items>

     

  13. Erjan Gavalji
    Admin
    Erjan Gavalji avatar
    1411 posts
    Member since:
    Sep 2012

    Posted 26 Aug 2008 Link to this post

    Hi Terry,

    Please, find attached the page I used. Can you please, modify it to demonstrate the error? Please, open a formal support ticket to send us the modified file.

    Thanks,
    Erjan Gavalji
    the Telerik team


    Check out Telerik Trainer, the state of the art learning tool for Telerik products.

  14. Terry Duke
    Terry Duke avatar
    2 posts
    Member since:
    Jul 2008

    Posted 26 Aug 2008 Link to this post

    I already submitted a ticket and recieved a working example. I traced the problem to something in our master page. I also found that if I put the dynamic creation code in the PageInit handler instead of the PageLoad handler it all works fine. I don't have time to pursure it further right now.

    Terry

  15. Adam
    Adam avatar
    177 posts
    Member since:
    Oct 2012

    Posted 26 Aug 2008 Link to this post

    Our toolbar is also in a master page, if that means anything.

  16. Erjan Gavalji
    Admin
    Erjan Gavalji avatar
    1411 posts
    Member since:
    Sep 2012

    Posted 26 Aug 2008 Link to this post

    Hi guys,

    Thanks for the clarifications. I just modified the example to use a master page, but still no results.

    Anyways, we will check this issue again once we have other clues of why it can happen.

    If you guys find a repro-scenario, please, send it to us too. We will check the problem immediately.

    Best regards,
    Erjan Gavalji
    the Telerik team


    Check out Telerik Trainer, the state of the art learning tool for Telerik products.

  17. Adam
    Adam avatar
    177 posts
    Member since:
    Oct 2012

    Posted 26 Aug 2008 Link to this post

    We're going to be using the new toolbar on a considerable number of pages. If we experience more issues and I can reproduce it on a simpler page (the one we are currently experiencing it on is a huge one and difficult to strip down and still have the issue), then I'll send in an example.

  18. Armen
    Armen avatar
    2 posts
    Member since:
    Feb 2008

    Posted 30 Nov 2009 Link to this post

    Hi people,

    I am using Telerik 2009.3 version. My specific scenario is following:
    I have a grid which shows all records in large form when specific row is selected.
    The form itself is in panel which is visible="false" by default and is visible when some row is selected. at first page load the form asp:panel is not visible.
    When I am putting the toolbar in the form panel I am getting the error - Error: Sys.WebForms.PageRequestManagerServerErrorException: Only items of type Telerik.Web.UI.IRadToolBarButton can initiate postbacks

    while when I taking RadToolBar out from this asp:panel it works just fine.

    Thanks in advance,
    Armen

  19. Armen
    Armen avatar
    2 posts
    Member since:
    Feb 2008

    Posted 07 Dec 2009 Link to this post

    Hi Erjan,

    To reproduce the problem you may check this simple code. The problem is because the container of toolbar has property of enableviewstate set the to false, I just turned it on and it works. Hope this will help to some folks that may have this issue.

    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="TestToolbar._Default" %> 
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
    <html xmlns="http://www.w3.org/1999/xhtml">  
    <head runat="server">  
        <title></title>  
    </head> 
    <body> 
        <form id="form1" runat="server">  
            <telerik:radscriptmanager id="RadScriptManager1" runat="server">  
                <Scripts> 
                    <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" /> 
                    <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" /> 
                </Scripts> 
            </telerik:radscriptmanager> 
            <telerik:radformdecorator runat="server" id="defaultFormDecorator"   
                Skin="Forest" /> 
            <telerik:radajaxloadingpanel id="defaultLoadingPanel" runat="server"   
                IsSticky="True" MinDisplayTime="200" Skin="Forest" /> 
            <telerik:radajaxmanager id="defaultAjaxManager" runat="server"></telerik:radajaxmanager> 
            <telerik:radajaxpanel runat="server" id="supplierAjaxPanel" loadingpanelid="defaultLoadingPanel" EnableViewState="false">  
                <asp:Label ID="lblTest" runat="server"></asp:Label> 
                <asp:Button id="btnShow" runat="server" onclick="btnShow_Click" Text="Show" /> 
                <asp:Panel ID="pnlToolbar" runat="server" Visible="false">  
                <telerik:RadToolBar runat="server" ID="rtbManage" CssClass="Toolbar" Width="100%"   
                        OnButtonClick="rtbManage_ButtonClick" Skin="Forest">  
                    <Items> 
                        <telerik:RadToolBarButton ImageUrl="~/Resources/Toolbar/Save.gif" ImagePosition="Left" 
                            Text="SaveText" CommandName="SaveButton" runat="server">  
                        </telerik:RadToolBarButton> 
                        <telerik:RadToolBarButton ImageUrl="~/Resources/Toolbar/cancel.png" ImagePosition="Left" 
                            Text="Cancel" CommandName="Cancel" runat="server">  
                        </telerik:RadToolBarButton> 
                        <telerik:RadToolBarButton ImageUrl="~/Resources/Toolbar/delete.png" ImagePosition="Left" 
                            Text="Delete" CommandName="Delete" runat="server">  
                        </telerik:RadToolBarButton> 
                    </Items> 
                </telerik:RadToolBar> 
            </asp:Panel> 
        </telerik:radajaxpanel> 
        </form> 
    </body> 
    </html> 
     

    using System;  
    using System.Collections.Generic;  
    using System.Linq;  
    using System.Web;  
    using System.Web.UI;  
    using System.Web.UI.WebControls;  
    using Telerik.Web.UI;  
     
    namespace TestToolbar  
    {  
        public partial class _Default : System.Web.UI.Page  
        {  
            protected void Page_Load(object sender, EventArgs e)  
            {  
     
            }  
     
            protected void rtbManage_ButtonClick(object sender, RadToolBarEventArgs e)  
            {  
                RadToolBarButton btn = e.Item as RadToolBarButton;  
                lblTest.Text = "Command: " + btn.CommandName;  
            }  
     
            protected void btnShow_Click(object sender, EventArgs e)  
            {  
                pnlToolbar.Visible = !pnlToolbar.Visible;  
            }  
     
        }  
    }  
     

    Regards,
    Armen

  20. Dan Meineck
    Dan Meineck avatar
    2 posts
    Member since:
    Dec 2009

    Posted 11 Jan 2010 Link to this post

    Has this issue been solved? I'm getting the same problem, even if I specifically set the EnableViewState property to true on the surrounding RadPane control.

  21. Yana
    Admin
    Yana avatar
    4364 posts
    Member since:
    Sep 2012

    Posted 12 Jan 2010 Link to this post

    Hi Dan,

    Please paste here sample code which we can use to replicate the issue. Thanks
     
    Regards,
    Yana
    the Telerik team


    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.

  22. Dan Meineck
    Dan Meineck avatar
    2 posts
    Member since:
    Dec 2009

    Posted 12 Jan 2010 Link to this post

    Hi Yana,


    Thanks for your reply.

    On further investigation I've fixed the problem - during the postback the toolbar was getting hidden, which I believe causes this problem. I've since modified my code to only hide the toolbar for my required circumstance when the request isn't a postback.

    Why does the postback processing require the control to be visible? It's not a massive problem for me, I'm just interested as to why your code makes this requirement?

    Thanks.

    Dan

  23. Yana
    Admin
    Yana avatar
    4364 posts
    Member since:
    Sep 2012

    Posted 15 Jan 2010 Link to this post

    Hi Dan,


    Which version of the controls you are using? Please send us simple code which demonstrates the problem as I am not able to understand it. Thanks

    All the best,
    Yana
    the Telerik team


    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.

  24. hll
    hll avatar
    29 posts
    Member since:
    Aug 2008

    Posted 19 Jan 2010 Link to this post

    I am also having same problem.
    Using Telerik Q3 SP1.

    I have both telerik treeview and telerik toolbar on my usercontrol.
    According to the selected node in the treeview, i am changing the RadToolBarButtons of telerik toolbar. (I mean i am clearing toolbar in the server side, and creating new buttons.  -in the OnNodeClick event of treeview.-)

    I am getting this exception when i click some of the buttons on telerik toolbar. (I am not getting this exception always.)

    What should i do?


  25. hll
    hll avatar
    29 posts
    Member since:
    Aug 2008

    Posted 19 Jan 2010 Link to this post

    anyway, fixed that...

  26. Golem
    Golem avatar
    20 posts
    Member since:
    Jun 2008

    Posted 10 Mar 2011 Link to this post

    Fixed it how?

  27. Kishan Gandikota
    Kishan Gandikota avatar
    44 posts
    Member since:
    Sep 2009

    Posted 06 Feb 2012 Link to this post

    Hi Folks/Telerik team- Did we find any root cause for this problem? Is there any solution for this?

  28. Kate
    Admin
    Kate avatar
    1898 posts
    Member since:
    Sep 2012

    Posted 09 Feb 2012 Link to this post

    Hi Kishan,

    Can you please open a separate forum post or a support ticket and explain the issue since the one that is described in this forum post is quite old one and we have been making changes in our controls(implying that the issue may no longer appear or is already fixed).

    Kind regards,
    Kate
    the Telerik team

    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>

  29. Justin
    Justin avatar
    3 posts
    Member since:
    Sep 2012

    Posted 18 Jul 2012 Link to this post

    Hi there, I am not sure if this will help anyone, but I was receiving this same error message.  I was able to resolve this by enabling viewstate for the RadToolBar (the default).  I had specifically turned off viewstate when testing another scenario.  I would guess that some part of toolbar's viewstate is keeping track of the control that initiates a postback.

Back to Top
DevCraft Release