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

problem with toolbar in commandItemtemplate of radgrid

2 Answers 72 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Moises
Top achievements
Rank 2
Moises asked on 12 Sep 2008, 06:31 PM
Hello i have a problem with toolbar and radgrid
im using a toolbar in commanditemtemplate and i have, new, edit, delete, and export buttons in the toolbar, my question is :

how i can detect from client javascript what button of toolbar has been clicked?

i have this code

function mngRequestStarted(ajaxManager, eventArgs) {
            if (eventArgs.EventTarget == "radGridCajas$ctl00$ctl02$ctl00$radToolBarAcciones") {               
                eventArgs.EnableAjax = false;
            }
        }

but this code only detect when any button of toolbar has clicked




2 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 15 Sep 2008, 06:29 AM
Hello Moises,

You can use OnClientButtonClicking/OnClientButtonClicked events in RadToolBar to set a variable and check this in OnRequestStart.

Greetings,
Vlad
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Accepted
Shinu
Top achievements
Rank 2
answered on 15 Sep 2008, 07:42 AM
Hi Moises,

Try the following code snippet to achieve the desired scenario.

ASPX:
    <CommandItemTemplate> 
                <telerik:RadToolBar ID="RadToolBar1" OnClientButtonClicked="OnClientButtonClicked"  runat="server"
                 <Items> 
                   <telerik:RadToolBarButton Text="My Button1"
                   </telerik:RadToolBarButton> 
                   <telerik:RadToolBarButton Text="My Button2" ></telerik:RadToolBarButton> 
                 </Items> 
                </telerik:RadToolBar> 
            </CommandItemTemplate> 

JS:
 <script type="text/javascript" language="javascript" > 
          
       function OnClientButtonClicked(sender, args) 
         { 
            var button = args.get_item(); 
            alert("You have Clicked:"+ button.get_text()); 
          }  
 </script>   


Thanks
Shinu.
Tags
Grid
Asked by
Moises
Top achievements
Rank 2
Answers by
Vlad
Telerik team
Shinu
Top achievements
Rank 2
Share this question
or