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

Issue in using an external javascript file in RadCodeBlock

1 Answer 92 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Shajan
Top achievements
Rank 1
Shajan asked on 30 Nov 2012, 04:53 AM
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

1 Answer, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 04 Dec 2012, 01:06 PM
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.
Tags
General Discussions
Asked by
Shajan
Top achievements
Rank 1
Answers by
Eyup
Telerik team
Share this question
or