<rad:RadToolbar ID="RadToolbarCustomer" style="position:absolute; left: 790px; top: 130px;" runat="server" skinspath="/XLogix/RadControls/ToolBar/Skins/" skin="XLogixBlue" AutoPostBack="true"
ImagesDir="/XLogix/RadControls/ToolBar/Skins/XLogixBlue/img/" OnOnClick="RadToolBar_OnClick">
<Items>
<rad:RadToolbarButton id="CreateButton" commandname="Create" DisplayType="TextImage" ButtonText="Create" ButtonImage="add_24.gif" tooltip="Create new order for this customer" width="90px" runat="server"/>
<rad:RadToolbarButton id="UpdateButton" commandname="Update" DisplayType="TextImage" ButtonText="Update" ButtonImage="add_24.gif" tooltip="Update order for this customer" width="90px" runat="server"/>
</Items>
</rad:RadToolbar>
this other toolbar on the same page does not have the same problem both using the same onclick event handler
<rad:RadToolbar ID="RadToolbarProduct" style="position:absolute; left: 570px; top: 620px;" runat="server" skinspath="/XLogix/RadControls/ToolBar/Skins/" skin="XLogixBlue" AutoPostBack="true"
ImagesDir="/XLogix/RadControls/ToolBar/Skins/XLogixBlue/img/" OnOnClick="RadToolBar_OnClick" Enabled="False" >
<Items>
<rad:RadToolbarButton id="DeleteBtn" commandname="Delete" DisplayType="TextImage" ButtonText="Delete" ButtonImage="remove_24.gif" tooltip="Delete item from order" width="90px" Enabled="False" Hidden="False" runat="server"/>
<rad:RadToolbarButton id="AddBtn" commandname="Add" DisplayType="TextImage" ButtonText="Add" ButtonImage="add_24.gif" tooltip="Add item to order" width="90px" Enabled="False" Hidden="False" runat="server"/>
<rad:RadToolbarButton id="NewBtn" commandname="New" DisplayType="TextImage" ButtonText="New" ButtonImage="add_24.gif" tooltip="Create item to add to order" width="90px" Enabled="False" Hidden="False" runat="server"/>
<rad:RadToolbarButton id="DoneBtn" commandname="Done" DisplayType="TextImage" ButtonText="Done" ButtonImage="add_24.gif" tooltip="Complete Order" width="90px" Enabled="False" Hidden="False" runat="server"/>
</Items>
</rad:RadToolbar>
This problem occurs if i have ajax on or off toolbar dll version is 1.6.5.0
16 Answers, 1 is accepted
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="essential3.WebForm1" %>
<%@ Register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" %>
<!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">
<div>
<telerik:RadScriptManager ID="RadScriptManager1" Runat="server">
</telerik:RadScriptManager>
<telerik:RadToolBar ID="RadToolBar1" Runat="server">
<Items>
<telerik:RadToolBarButton runat="server" NavigateUrl="~/Webform1.aspx"
PostBack="False" Text="Button 0">
</telerik:RadToolBarButton>
</Items>
</telerik:RadToolBar>
</div>
</form>
</body>
</html>
and the form load event runs twice
thanks
kevin
Do you mean that the ButtonClick eventhandler for the RadToolBar is called twice? If this is the case, could it be that you keep a reference to the RadToolBar instance in the Session? RadControls should not be stored in the Session, because of possible memory leaks and other problems (like having the event raised twice - once for the old instance and one for the new one).
If this is not the case, is it possible for you to prepare a small sample project and send it to us for testing (you could use your project if it is small one as well)?
Kind regards,
Erjan Gavalji
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
the aspx code is above and the c# code is just
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace essential3
{
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
int x = 1;
}
}
}
if i click the button on the tool bar int x = 1 breakpoint gets hit twice !!
I get it now. Can you please, use the Firebug tool for Firefox, or the Fiddler tool for Internet Explorer to check if there are any other requests to the page? It is possible that some image or some <link> tag try to access the page URL.
Kind regards,
Erjan Gavalji
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
kevin
kevin
Strange indeed, I just tested the same ASPX and the codebehind with IE6 and I did not have the problem...
Can you send us the ASPX file, its codebehind file and the designer file for a test (please use a formal support ticket to attach the files).
Kind regards,
Erjan Gavalji
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
thanks
kevin
I'm having the same problem. My RadToolbar is in a user control and uses the NavigateUrl="nextpage.aspx" on the buttons to go the next page. When debugging, the "nextpage.aspx" Page_Load() event handler is executed twice as if there are two requests being generated.
This seems to be isolated to IE (I'm running IE7). Works fine in Firefox and Chrome.
I'm running version v2.0.50727.
Best wishes,
Simon
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.
Kind regards,
Simon
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.
<
telerik:RadToolBar
runat
=
"server"
ID
=
"RadToolBar1"
OnButtonClick
=
"RadToolBar1_ButtonClick"
>
<
Items
>
<
telerik:RadToolBarButton
Text
=
"Show Messages For All Users"
runat
=
"server"
CommandName
=
"FilterMessages"
CommandArgument="All">
</
telerik:RadToolBarButton
>
</
Items
>
</
telerik:RadToolBar
>
and in the code behind:
protected void RadToolBar1_ButtonClick(object sender, RadToolBarEventArgs e)
{
RadToolBarButton button = e.Item as RadToolBarButton;
if (button.CommandName == "FilterMessages")
{
if (button.CommandArgument == "All")
{
button.Text = "Show Only My Messages";
button.CommandArgument = "Mine";
return;
}
if (button.CommandArgument == "Mine")
{
button.Text =
"Show Messages For All Users";
button.CommandArgument = "All";
return;
}
}
}
The two return statements prevent "
RadToolBar1_ButtonClick
" from executing a second time after postback.When you click on the "All" button both if-bodies in the Click handler execute. Perhaps this gives the impression that the handler executes twice and putting the return statements works.
protected
void
RadToolBar1_ButtonClick(
object
sender, RadToolBarEventArgs e)
{
RadToolBarButton button = e.Item
as
RadToolBarButton;
if
(button.CommandName ==
"FilterMessages"
)
{
if
(button.CommandArgument ==
"All"
)
{
button.Text =
"Show Only My Messages"
;
button.CommandArgument =
"Mine"
;
return
;
}
if
(button.CommandArgument ==
"Mine"
)
{
button.Text =
"Show Messages For All Users"
;
button.CommandArgument =
"All"
;
return
;
}
}
}
I hope this sheds some more light on the subject.
Kind regards,
Simon
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Yes, a switch fits perfectly in this case.
Have a great and productive week!
Regards,
Simon
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.