<% Html.Telerik().ScriptRegistrar()
.OnDocumentReady(() => {%>
var undoButton = $('#undo');
undoButton
.bind('click', function(e) {
alert('test');
var windowElement = $.telerik.window.create({
title: "Insert image",
html: "<
strong
>Inserting an image...</
strong
>",
contentUrl: '',
modal: true,
resizable: false,
draggable: true,
onClose: function() {}
});
})
.toggle(!windowElement.is(':visible'));
<%}); %>
<
span
id
=
"undo"
class
=
"t-group"
>Click here to open the window.</
span
>
It doesn't work, I get an error:
"Line: 163
Error: Unable to get value of the property 'create': object is null or undefined"
What am I doing wrong?
8 Answers, 1 is accepted
Thank you for contacting us.
I think you are not including the required JavaScript files for the window.
If this does not help I would ask you to provide a sample application which we can test locally.
Hristo Germanov
the Telerik team
Thank you for contacting us.
I think you are not including the required JavaScript files for the window.
If this does not help I would ask you to provide a sample application which we can test locally.
Hristo Germanov
the Telerik team
<script src="/Scripts/2011.1.324/jquery-1.5.1.min.js" type="text/javascript"></script>
<script src="/Scripts/2011.1.324/telerik.common.min.js" type="text/javascript"></script>
<script src="/Scripts/2011.1.324/telerik.draganddrop.min.js" type="text/javascript"></script>
<script src="/Scripts/2011.1.324/telerik.window.min.js" type="text/javascript"></script>
in the HEAD tag. That's ok, right? Still not working, same error. The annoying thing is that your demo is yet again working fine :)
I sent a support ticket with attachment:
What I've done;
- Created a new MVC 3 project
- Chose the Telerik template
- Added the client side create code to About.aspx
- Added the script requirement to the head tag
The result is that the scriptcode isn't rendered as script, but as text so it doesn't work. It's probably something really stupid, but I'm entirely stuck on this.
@(Html.Telerik().ScriptRegistrar().DefaultGroup(group => group.Add("telerik.common.js")
.Add("telerik.draganddrop.min.js")
.Add("telerik.window.min.js")))
Could you please examine the attached project and tell me it if works for you.
Greetings,Hristo Germanov
the Telerik team