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

Client side create not working

8 Answers 132 Views
Window
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Datamex
Top achievements
Rank 2
Datamex asked on 02 Apr 2011, 05:39 PM
I'm using this code to create a new window client side:

<% 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

Sort by
0
Hristo Germanov
Telerik team
answered on 04 Apr 2011, 08:03 AM
Hi Datamex,

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.

Best wishes,
Hristo Germanov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Hristo Germanov
Telerik team
answered on 04 Apr 2011, 08:03 AM
Hi Datamex,

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.

Best wishes,
Hristo Germanov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Datamex
Top achievements
Rank 2
answered on 05 Apr 2011, 08:11 PM
Ok, so now I have

    <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 :)
0
Datamex
Top achievements
Rank 2
answered on 05 Apr 2011, 08:46 PM

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.

0
Mike
Top achievements
Rank 1
answered on 06 Apr 2011, 01:23 AM
I was having the same issue. Try adding the following to the top of your view (the one that contains the window.create client statement).

@(Html.Telerik().ScriptRegistrar().DefaultGroup(group => group.Add("telerik.common.js")
.Add("telerik.draganddrop.min.js")
.Add("telerik.window.min.js")))
0
Datamex
Top achievements
Rank 2
answered on 06 Apr 2011, 07:35 AM
Could someone fill me in on the registering stuff? Does it make any difference where you register files (master page / view / partial view)? And for the <script> incudes from above: what's the proper way to do it so the references don't break when I update the Telerik version?
0
Hristo Germanov
Telerik team
answered on 06 Apr 2011, 09:54 AM
Hello Datamex,

Could you please examine the attached project and tell me it if works for you.

Greetings,
Hristo Germanov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Datamex
Top achievements
Rank 2
answered on 06 Apr 2011, 09:58 AM
Yes it does, thanks. I'll use this code in my own project.
Tags
Window
Asked by
Datamex
Top achievements
Rank 2
Answers by
Hristo Germanov
Telerik team
Datamex
Top achievements
Rank 2
Mike
Top achievements
Rank 1
Share this question
or