Calling client-side click event first followed by server-side click event

6 posts, 0 answers
  1. Polaris431
    Polaris431 avatar
    30 posts
    Member since:
    Jul 2007

    Posted 21 Jan 2009 Link to this post

    In a typical situation where you have a "Delete" button on the toolbar and the user presses it, you would first want to prompt the user whether they really want to perform the delete. If the user declines, the deletion is canceled. If they choose to delete, code on the server-side needs to be executed to carry out the delete. The toolbar does support the ButtonClick event. Is it possible to call this method from within a javascript function (where my prompting is carried out). Until now I have used the ajaxRequest method to send commands back to the server but I find this kind of ugly. It would be nice to use the method that is associated with the toolbar because some toolbar buttons will cause this event to be executed without going through a javascript function.
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 21 Jan 2009 Link to this post

    Hello,

    You can try out the following code to display a confirm message on clicking a RadToolBarButton:
    aspx:
    <telerik:RadToolBar ID="RadToolBar1" Width="1000px" runat="server" OnButtonClick="RadToolBar1_ButtonClick"
            <Items> 
            <telerik:RadToolBarButton Text="SelectAll">                
            </telerik:RadToolBarButton> 
            <telerik:RadToolBarButton Text="DeleteAll" CommandName="DeleteSelected" ></telerik:RadToolBarButton> 
            <telerik:RadToolBarButton Text="Refresh" ></telerik:RadToolBarButton> 
            <telerik:RadToolBarButton Text="View" ></telerik:RadToolBarButton> 
            </Items> 
    </telerik:RadToolBar> 

    js:
    <script type="text/javascript"
        function clientbuttonclick(sender, args) 
        { 
           
          var button = args.get_item(); 
                if (button.get_commandName() == "DeleteSelected") 
                { 
                    args.set_cancel(!confirm('Delete all selected customers?')); 
                } 
        }     
     </script> 

    cs:
     protected void RadToolBar1_ButtonClick(object sender, RadToolBarEventArgs e) 
        { 
            
        } 

    Thanks
    Princy.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Andrew
    Andrew avatar
    125 posts
    Member since:
    Sep 2008

    Posted 06 Apr 2010 Link to this post

    can someone help me with this, I cannot get this to work. here is my code, comfimation does not appear


     

    <telerik:RadToolBar ID="RadToolBar1" runat="server" onbuttonclick="RadToolBar1_ButtonClick" Width="100%">  
        <Items> 
            <telerik:RadToolBarDropDown ToolTip="Add" Text="Add" Width="60px">  
                <Buttons> 
                    <telerik:RadToolBarButton Enabled="true" Text="Elective Period" ToolTip="Add A Elective Period" Value="AddElective" /> 
                    <telerik:RadToolBarButton Enabled="true" Text="Program Options" ToolTip="Add A Program Option" Value="AddProgram" /> 
                    <telerik:RadToolBarButton Enabled="true" Text="Round" ToolTip="Add A Round" Value="AddRound" /> 
                </Buttons> 
            </telerik:RadToolBarDropDown> 
            <telerik:RadToolBarButton ToolTip="Edit ROL" Text="Edit" Width="60px" Value="EditROL">  
            </telerik:RadToolBarButton> 
            <telerik:RadToolBarButton ToolTip="Delete All ROL Child Records" Text="Delete" Width="60px" Value="DeleteROLChildren" CommandName="DeleteROLChildren" > 
            </telerik:RadToolBarButton> 
        </Items> 
    </telerik:RadToolBar> 

     

    <script type="text/javascript">  
        
        function clientbuttonclick(sender, args)    
        {    
              
            var button = args.get_item();    
            if (button.get_commandName() == "DeleteROLChildren")    
            {    
                args.set_cancel(!confirm('Are you sure you want to delete ALL ROL child records?'));    
            }    
        }    
              
     </script>  

     


    got it, the example is missing

     

    OnClientButtonClicking

     

    ="clientbuttonclick"

     

     

     

     

     

     

     

     

     

     

     

  5. Stacy
    Stacy avatar
    98 posts
    Member since:
    Dec 2010

    Posted 19 Apr 2011 Link to this post

    Where do you put "OnClientButtonClicking"?  It says it's not an event for RadToolbarButtons...
  6. Andrew
    Andrew avatar
    125 posts
    Member since:
    Sep 2008
  7. Kate
    Admin
    Kate avatar
    1898 posts

    Posted 21 Apr 2011 Link to this post

    Hi Stacy,

    Please refer to this forum thread.

    Best wishes,
    Kate
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Back to Top
UI for ASP.NET Ajax is Ready for VS 2017