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

OnClientButtonClicking is undefined

3 Answers 121 Views
ToolBar
This is a migrated thread and some comments may be shown as answers.
Jeffrey Snyder
Top achievements
Rank 1
Jeffrey Snyder asked on 14 Dec 2009, 08:35 PM
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

3 Answers, 1 is accepted

Sort by
0
Veselin Vasilev
Telerik team
answered on 17 Dec 2009, 12:22 PM
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.
0
Jeffrey Snyder
Top achievements
Rank 1
answered on 20 Dec 2009, 10:01 PM
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.
0
Veselin Vasilev
Telerik team
answered on 21 Dec 2009, 04:22 PM
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.
Tags
ToolBar
Asked by
Jeffrey Snyder
Top achievements
Rank 1
Answers by
Veselin Vasilev
Telerik team
Jeffrey Snyder
Top achievements
Rank 1
Share this question
or