This is a migrated thread and some comments may be shown as answers.

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

29 Answers 375 Views
ToolBar
This is a migrated thread and some comments may be shown as answers.
Adam
Top achievements
Rank 1
Adam asked on 29 Jul 2008, 03:48 PM
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

29 Answers, 1 is accepted

Sort by
0
Erjan Gavalji
Telerik team
answered on 31 Jul 2008, 12:14 PM
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.
0
Adam
Top achievements
Rank 1
answered on 04 Aug 2008, 03:59 PM
We're not using a RadAjaxManager on the page at all, so I don't believe that is the issue.
0
Erjan Gavalji
Telerik team
answered on 04 Aug 2008, 04:39 PM
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.
0
Adam
Top achievements
Rank 1
answered on 04 Aug 2008, 04:46 PM
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.
0
Erjan Gavalji
Telerik team
answered on 04 Aug 2008, 04:53 PM
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.
0
Adam
Top achievements
Rank 1
answered on 07 Aug 2008, 08:21 PM
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.
0
Erjan Gavalji
Telerik team
answered on 08 Aug 2008, 08:04 AM
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.
0
Adam
Top achievements
Rank 1
answered on 08 Aug 2008, 01:03 PM
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.
0
Erjan Gavalji
Telerik team
answered on 11 Aug 2008, 05:31 AM
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.
0
Terry Duke
Top achievements
Rank 1
answered on 22 Aug 2008, 01:10 PM
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>

 

0
Erjan Gavalji
Telerik team
answered on 26 Aug 2008, 06:34 AM
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.
0
Terry Duke
Top achievements
Rank 1
answered on 26 Aug 2008, 12:31 PM
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
0
Adam
Top achievements
Rank 1
answered on 26 Aug 2008, 01:22 PM
Our toolbar is also in a master page, if that means anything.
0
Erjan Gavalji
Telerik team
answered on 26 Aug 2008, 01:35 PM
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.
0
Adam
Top achievements
Rank 1
answered on 26 Aug 2008, 01:43 PM
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.
0
Armen
Top achievements
Rank 1
answered on 30 Nov 2009, 06:11 PM
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
0
Armen
Top achievements
Rank 1
answered on 07 Dec 2009, 12:15 PM
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
0
Dan Meineck
Top achievements
Rank 1
answered on 11 Jan 2010, 10:11 AM
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.
0
Yana
Telerik team
answered on 12 Jan 2010, 02:05 PM
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.
0
Dan Meineck
Top achievements
Rank 1
answered on 12 Jan 2010, 08:47 PM
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
0
Yana
Telerik team
answered on 15 Jan 2010, 11:21 AM
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.
0
hll
Top achievements
Rank 1
answered on 19 Jan 2010, 01:53 PM
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?


0
hll
Top achievements
Rank 1
answered on 19 Jan 2010, 05:37 PM
anyway, fixed that...
0
Golem
Top achievements
Rank 1
answered on 10 Mar 2011, 05:13 PM
Fixed it how?
0
Kishan Gandikota
Top achievements
Rank 1
answered on 06 Feb 2012, 01:06 PM
Hi Folks/Telerik team- Did we find any root cause for this problem? Is there any solution for this?
0
Kate
Telerik team
answered on 09 Feb 2012, 03:48 PM
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 >>
0
Justin
Top achievements
Rank 1
answered on 18 Jul 2012, 11:04 PM
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.
0
alex
Top achievements
Rank 1
answered on 23 Nov 2016, 03:39 AM

Hi there,

Has this issue been solved?

I got the same problem since I upgraded telerik dlls from 2010.1.519.40 to 2016.3.914.40. It's never been caught until I applied new dlls. Is there anything changed to cause the problem?

Thanks,

0
Ivan Danchev
Telerik team
answered on 24 Nov 2016, 09:22 AM
Hello Alex,

Please post your ToolBar's markup declaration, which will give us an idea of how it is configured and what items it contains. In addition specify the steps needed to be followed, in order for the exception to be reproduced.

Regards,
Ivan Danchev
Telerik by Progress
Telerik UI for ASP.NET AJAX is ready for Visual Studio 2017 RC! Learn more.
Tags
ToolBar
Asked by
Adam
Top achievements
Rank 1
Answers by
Erjan Gavalji
Telerik team
Adam
Top achievements
Rank 1
Terry Duke
Top achievements
Rank 1
Armen
Top achievements
Rank 1
Dan Meineck
Top achievements
Rank 1
Yana
Telerik team
hll
Top achievements
Rank 1
Golem
Top achievements
Rank 1
Kishan Gandikota
Top achievements
Rank 1
Kate
Telerik team
Justin
Top achievements
Rank 1
alex
Top achievements
Rank 1
Ivan Danchev
Telerik team
Share this question
or