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

callback stopped working on the Toolbar

9 Answers 135 Views
ToolBar
This is a migrated thread and some comments may be shown as answers.
Bernard
Top achievements
Rank 1
Bernard asked on 13 Jun 2014, 01:32 PM
Hi,
I just upgrade from 2013.2.611.35 to 2014.1.403.35. And now the callback stopped working on the Toolbar. 

<telerik:RadToolBar ID="toolBar" runat="server" BackColor="White" Width="850px" AutoPostBack="True"
        OnButtonClick="toolBar_ButtonClick">
        <Items>
...
The event "OnButtonClick" is not fired.
Have you any idea about this issue ?
Regards
Bernard

9 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 16 Jun 2014, 06:48 AM
Hi Bernard,

The provided information is not enough to replicate the issue. Please have a look into the sample code snippet which works fine at my end, also take a look into the attached screenshots. Please provide your full code if it doesn't help.

ASPX:
<telerik:RadToolBar ID="rtoolbarServerClick" runat="server" OnButtonClick="rtoolbarServerClick_ButtonClick">
    <Items>
        <telerik:RadToolBarButton Text="Item1">
        </telerik:RadToolBarButton>
    </Items>
</telerik:RadToolBar>

C#:
protected void rtoolbarServerClick_ButtonClick(object sender, Telerik.Web.UI.RadToolBarEventArgs e)
{
    string clickedText = e.Item.Text;
}

Thanks,
Shinu.
0
Bernard
Top achievements
Rank 1
answered on 16 Jun 2014, 08:32 AM
Hello Shinu,
Many thanks for your replay.
Some additional information:
The toolbar is in a Master Page.
My OS is W7 64 bit
The FW used is 3.5
What I do not understand is that with the previous version 2013.2.611.35 it works.
When I just replace the Telerik.Web.UI.dll and Telerik.Web.UI.Skins.dll by the 2014.1.403.35,  it doesn't work
Here is the code...


<asp:Content ID="Content2" ContentPlaceHolderID="cphMenu" runat="server">
    <telerik:RadToolBar ID="toolBar" runat="server" BackColor="White" Width="850px" AutoPostBack="True" 
        OnButtonClick="toolBar_ButtonClick">
        <Items>
            <telerik:RadToolBarButton runat="server" ToolTip="Retour" Value="RET" ImageUrl="~/images/Retour.png">
            </telerik:RadToolBarButton>
            <telerik:RadToolBarButton runat="server" ToolTip="Affichage Ua" Value="DUA" ImageUrl="~/images/DescrUA.png"
                Enabled="False">
            </telerik:RadToolBarButton>
            <telerik:RadToolBarButton runat="server" Value="DEM" ImageUrl="~/images/DdeRestitution.png"
                Enabled="False">
            </telerik:RadToolBarButton>
            <telerik:RadToolBarButton runat="server" Value="LOC" ImageUrl="~/images/LocalisationGeoUA.png"
                Enabled="False">
            </telerik:RadToolBarButton>
            <telerik:RadToolBarButton runat="server" Value="ETQ" ImageUrl="~/images/EditionEtiquettes.png"
                Enabled="False">
            </telerik:RadToolBarButton>
            <telerik:RadToolBarButton runat="server" ToolTip="Liste PDF" Value="PDF" ImageUrl="~/images/FluxPdf.png"
                Enabled="False">
            </telerik:RadToolBarButton>
            <telerik:RadToolBarButton runat="server" Value="XLS" ImageUrl="~/images/FluxXls.png">
            </telerik:RadToolBarButton>
            <telerik:RadToolBarButton runat="server" Value="CSV" ImageUrl="~/images/Csv.png">
            </telerik:RadToolBarButton>
            <telerik:RadToolBarButton runat="server" ToolTip="Liste XML" Value="XML" ImageUrl="~/images/FluxXml.png"
                Enabled="False">
            </telerik:RadToolBarButton>
            <telerik:RadToolBarButton runat="server" Value="MOD" ImageUrl="~/images/modifier.png"
                Enabled="False">
            </telerik:RadToolBarButton>
        </Items>
    </telerik:RadToolBar>
</asp:Content>


protected void toolBar_ButtonClick(object sender, RadToolBarEventArgs e)
        {
            GridDataItem anItem;
            TableCell aCell;
            dataContainer.xarcUaLstPrm.selectedUaList = new List<Ua>();
            bool toutEstLocal = false;
            bool toutEstVerse = false;
            try
            {
                switch (e.Item.Value)
                {
                    case @"RET":
                    ...
                        break;
                    case @"DEM":
        ...
Bernard
0
Bernard
Top achievements
Rank 1
answered on 16 Jun 2014, 10:03 AM
Hi Shinu,
Is it possible that the installation is done poorly?
Here is what I did:
I downloaded from the "DLL's, scripts, Skins and Resources only" of the "UI for ASP.NET AJAX"
And then I put the Telerik.Web.UI.dll and Telerik.Web.UI.Skins.dll of the Bin35 (My FW) in my bin web application.
I put the Telerik Web.Design.dll in the GAC.
Everything seems to work, Except the RadToolBar....
Bernard
0
Shinu
Top achievements
Rank 2
answered on 17 Jun 2014, 05:25 AM
Hi Bernard,

Unfortunately I couldn't replicate the issue at my end. Please have a look into the sample project which works fine at my end.

Thanks,
Shinu.
0
Bernard
Top achievements
Rank 1
answered on 17 Jun 2014, 05:31 AM
Ok Shinu,
Thanks
Bernard
0
Christiaan Ferreira
Top achievements
Rank 2
answered on 19 Jun 2014, 07:14 PM
Hi,

I'm facing a similar issue where my toolbar doesn't fire the OnButtonClick event for buttons initially set to enabled="false" since upgrading from Q1 2013 to Q2 2014.

In Q1 2013, when i enabled the button clientside using RadToolBar.findItemByValue("Delete").enable(); it would successfully cause a postback and fire the toolbar OnButtonClick event. After the postback occurred, the button would once again be disabled as expected as the clientside changes weren't persisted.

In Q2 2014, this is not the case. In order for the OnButtonClick event to be fired, i need to call the clientside trackChanges() and commitChanges() methods as in the example following, before the toolbar OnButtonClick event is fired.
e.g.
RadToolBar.trackChanges();
RadToolBar.findItemByValue("Delete").enable();
RadToolBar.commitChanges();

After following this approach to get the OnButtonClick event to fire, i need to explicitly disable the button server side to have the button return to being disabled after the postback.
This is completely understandable since the trackChanges and commitChanges forces the changes to be persisted.

I did however much prefer the way it worked previously and would like to know whether the previous implementation can somehow be achieved with the new 2014 controls.

Any advice would be greatly appreciated.

Thank you in advance.


0
Shinu
Top achievements
Rank 2
answered on 20 Jun 2014, 06:57 AM
Hi Christiaan Ferreira,

In order to achieve your scenario one suggestion is that please try to make the RadToolBarItem as disabled in pageLoad event as follows.

JavaScript:
function pageLoad() {
    var toolBar = $find("<%=rtoolbarDemo.ClientID%>");
    toolBar.findItemByValue("Delete").set_enabled(false);
}

Thanks,
Shinu.
0
Christiaan Ferreira
Top achievements
Rank 2
answered on 20 Jun 2014, 08:18 AM
Hi Shinu,

Thank you for your prompt reply.

Yes, disabling the button in clientside onload is one possible solution, thank you.

I did some testing and all controls up to and including version Q1 2014 (version 2014.1.225) - February 26, 2014 work as expected.

Ever since Q1 2014 SP1 (version 2014.1.403) - April 03, 2014, the default behavior has changed and a workaround approach is needed.
In the release notes for Q1 2014 SP1, it states the following...
"ToolBar: FIXED - Click events could be fired for disabled ToolbarButtons when using HTTP traffic recording tool."

Could this by any chance be the reason for the changed behavior, and is the current behavior the desired behavior or possibly a bug?

Thank you kindly.
0
Bernard
Top achievements
Rank 1
answered on 20 Jun 2014, 09:18 AM
Many Thanks Christiaan,
It's exactly my problem...
Only the ToolBar buttons which are disabled are affected by the issue. I didn't notice that !!!
So if I add the
toolBar.trackChanges();
toolBar.commitChanges(); 
in my fonction RowSelected, it works !
Thanks again,
Bernard
var buttonDEM;
function pageLoad() {
         ...
                toolBar = $find("<%=toolBar.ClientID %>");
                buttonDEM = toolBar.findItemByValue("DEM");
            }
function RowSelected(sender, eventArgs) {
                toolBar.trackChanges();
                buttonDEM.disable();
               ...
                if (toutEstVerse || (toutEstLocal && MVT_LOCAUX)) {
                    buttonDEM.enable();
                };
                ...
                toolBar.commitChanges();
            }
Tags
ToolBar
Asked by
Bernard
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Bernard
Top achievements
Rank 1
Christiaan Ferreira
Top achievements
Rank 2
Share this question
or