OnClientButtonClicking is undefined

4 posts, 0 answers
  1. Jeffrey Snyder
    Jeffrey Snyder avatar
    2 posts
    Member since:
    Oct 2009

    Posted 14 Dec 2009 Link to this post

    Hello,

    I have a RadGrid with a UserControl for the Edit command.  That UC contains both a RadToolbar and a RadEditor.  I want to verify client-side that the Editor contains some text when the user clicks a toolbar button.  I've subscribed to the OnClientButtonClicking event for the toolbar.  However, when the UC opens, I get a JavaScript error that 'OnClientButtonClicking' is undefined.

    Here is the declaration for the OnClientButtonClicking handler:

    <script type="text/javascript">  
    function OnClientButtonClicking(sender, args)  
    {  
        if (args.get_item().get_value() == "save") {  
            var editor = $find("<%=reComments.ClientID%>");  
            if (editor.get_text() == "") {  
                window.alert("You must enter Comments in order to have your request reviewed!");  
                args.set_cancel(true);  
            }  
        }  
    }  
    </script> 

    And here are the declarations for the RadEditor and RadToolbar:

    <telerik:radeditor  
        Skin="WebBlue" 
        EditModes="Design" 
        Width="80%" 
        Height="250px" 
        StripFormattingOnPaste="All" 
        ID="reComments" 
        runat="server" 
        toolsfile="~/ToolsFile.xml" 
        StripFormattingOptions="All">  
        <CssFiles><telerik:EditorCssFile Value="~/css/EditorContentArea.css" /></CssFiles>  
        <Content> 
        </Content> 
    </telerik:radeditor> 
     
    <telerik:radtoolbar OnClientButtonClicking="OnClientButtonClicking" Skin="Vista" Font-Names="Verdana" AutoPostBack="true" runat="server" id="Radtoolbar2">  
        <items> 
            <telerik:RadToolBarButton CommandArgument="save" CommandName="save" Enabled="false" ForeColor="White" Text="Submit Request" ImageUrl="../../images/save.gif" runat="server" ToolTip="Click here to submit your request to your supervisor." /> 
            <telerik:RadToolBarButton IsSeparator="true"></telerik:RadToolBarButton> 
            <telerik:RadToolBarButton CommandArgument="cancel" ForeColor="White" Text="Cancel & Return to Competency List" ImageUrl="../../images/back.gif" runat="server" ToolTip="Click here to cancel any changes made and return to the list of competencies." CommandName="Cancel" /> 
        </items> 
    </telerik:radtoolbar> 

    Again, the UC is opened for the Edit command of a RadGrid.

    Thanks in advance for your help!

    Jeff
  2. Veselin Vasilev
    Admin
    Veselin Vasilev avatar
    2992 posts

    Posted 17 Dec 2009 Link to this post

    Hi Jeffrey Snyder,

    Please place the javascript code in RadScriptBlock and try again.

    Sincerely yours,
    Veselin Vasilev
    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Jeffrey Snyder
    Jeffrey Snyder avatar
    2 posts
    Member since:
    Oct 2009

    Posted 20 Dec 2009 Link to this post

    Hi Veselin,

    I failed to mention in my original post that I have tried it both with and without RadCodeBlock.  The error is the same in either case.

    Jeff.
  5. Veselin Vasilev
    Admin
    Veselin Vasilev avatar
    2992 posts

    Posted 21 Dec 2009 Link to this post

    Hi Jeffrey Snyder,

    I think the best way to proceed is to send us a sample project which demonstrates the issue. It does not need to contain any real data - I just want to run it and see the javascript error.

    Thanks

    Best wishes,
    Veselin Vasilev
    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.
Back to Top