Error: .attachEvent is not a function

2 posts, 0 answers
  1. tom
    tom avatar
    4 posts
    Member since:
    Feb 2008

    Posted 06 Nov 2008 Link to this post

    I have a delete button on my toolbar that I need a popup before deleting.

    So, I need the delete button on the toolbar to confirm the user really wants to.

    I've followed the instructions below:
    http://www.telerik.com/help/aspnet/toolbar/tool_stop_postback.html

    I get the following error in my Firefox error console:  "....attachEvent is not a function"

    Here is my radtoolbar:
    <telerik:RadToolBar ID="UserAccessEditToolBar" runat="server"/> 
     
    and here is my javascript:
    <script type="text/javascript"
     
    <%= UserAccessEditToolBar.ClientID %>.attachEvent("OnClientClick","click_handler"); 
     
    function click_handler(sender, e) 
       if (sender.CommandName == "clientside") 
       { 
           // call clientside function here 
           return false; 
       } 
     
    </script> 
    any suggestions?



  2. tom
    tom avatar
    4 posts
    Member since:
    Feb 2008

    Posted 06 Nov 2008 Link to this post

    Resolved
    we found this article:
    http://www.telerik.com/support/kb/aspnet-ajax/window/using-radprompt-and-radconfirm-with-telerik-navigational-controls.aspx

    which gave us the javascript below




    <script type="text/javascript">   
            var lastClickedItem = null;      
            var clickCalledAfterRadprompt = false;   
            var clickCalledAfterRadconfirm = false;   
            function toolbarClicked(sender, args)   
            {   
                if (args.get_item().get_text() == "Delete")   
                {   
                    if (!clickCalledAfterRadconfirm)   
                    {   
                        args.set_cancel(true);   
                        lastClickedItem = args.get_item();               
                        radconfirm("Are you sure you want to postback?", confirmCallbackFunction);   
                     }   
                }   
                   
            }   
             function confirmCallbackFunction(args)   
            {                 
                if (args)   
                {     
                    clickCalledAfterRadconfirm = true;   
                    lastClickedItem.click();   
                }   
                else  
                clickCalledAfterRadconfirm = false;            
                lastClickedItem = null;   
            }   
            </script>   

    then this was our toolbar line:
        <telerik:RadToolBar ID="UserAccessEditToolBar" runat="server" AutoPostBack="true" OnButtonClick="UserAccessEditToolBar_ButtonClick" OnClientButtonClicking="toolbarClicked" /> 
     

    OnClientButtonClicking fires the javascript and the confirmation box.

    If the user hits OK and wants to delete the item, then the "OnButtonClick" is fired and actually deletes the record.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top