Issue in using an external javascript file in RadCodeBlock

2 posts, 0 answers
  1. Shajan
    Shajan avatar
    4 posts
    Member since:
    Jun 2012

    Posted 29 Nov 2012 Link to this post

    Hi All,

    I have a problem regarding javascript. When I am using external javascript(for validation purpose) in aspx page, its working fine. But when i am using external javascript to validate telerik controls, it is showing some errors. So kindly guide me how I can solve my issue.


    // This following code works fine.
    <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
            <script language="javascript" type="text/javascript">
                function Delete_Confirm(sender, args) {
                    var selRowCount = -1;
                    selRowCount = $find("<%=rgDocument.ClientID %>").get_masterTableView().get_selectedItems().length;

                    if (selRowCount > 0) {
                        radconfirm('Sure to delete?', deleteConfirmCallbackFn, 330, 100, null, 'Example', null);
                    }
                }

                function deleteConfirmCallbackFn(args) {
                    if (args) {
                        __doPostBack('toolBar', 'Delete');
                    }
                }
            </script>
        </telerik:RadCodeBlock>


    Now i have written the above script in "CommonJS.js" and included it in to "RadCodeBlock". But I am getting the error "function not defined.".


    <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
            <script type="text/javascript" src="js/CommonJS.js"></script>
                    
            </script>
        </telerik:RadCodeBlock>


    Thanks and Regards
    Shajan P K
  2. Eyup
    Admin
    Eyup avatar
    4087 posts

    Posted 04 Dec 2012 Link to this post

    Hi Shajan,

    I have created a sample web site to test the described issue. On my side everything works as expected and the external javascript function is executed correctly. Please check out the attached application and let me know about the result.

    Regards,
    Eyup
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top