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

Add Kendo Calendar in Window

2 Answers 161 Views
Window
This is a migrated thread and some comments may be shown as answers.
CH
Top achievements
Rank 1
CH asked on 14 Jul 2014, 08:25 AM
Hi,
I have a kendo-template which i put my Calendar widget in it. I tried to open the Window and load the template into my calendar end up having error and below are the error:
 Error: Invalid template:'
    <div id="details-container">
        <div class="k-widget k-calendar" id="test"></div><script>
    jQuery(function(){jQuery("#test").kendoCalendar({});});
' Generated code:'var o,e=kendo.htmlEncode;with(data){o='\n    <div id="details-container">\n        <div class="k-widget k-calendar" id="test"></div><script>\n\tjQuery(function(){jQuery("';test").kendoCalendar({});});
;o+=;}return o;'


Here is my Code:

@(Html.Kendo().Window().Name("Details").Title("Customer Details")
            .Visible(false).Modal(true).Draggable(true).Width(900).Height(400))

My template
<script type="text/x-kendo-template" id="CopyProjectTemplate">
    <div id="details-container">
        @(Html.Kendo().Calendar().Name("test"))
 
    </div>
</script>

Here is my Javascript that execute the code:
$(document).ready(function () {
     
      $("#grdTimelogDetail_btnSaveTemplate_onclick").click(function (e) {
          e.preventDefault();
          try {
           var detailsTemplate = kendo.template($("#CopyProjectTemplate").html());
                                  kendo.init($("#details-container"));
                                  var wnd = $("#Details").data("kendoWindow");
                                  wnd.content(detailsTemplate);
                                  wnd.center().open();
              return false;
          }
          catch (err) { alert(err); }
      });
 
  });

Any Idea how to get working?

thanks.

Regards,

2 Answers, 1 is accepted

Sort by
0
CH
Top achievements
Rank 1
answered on 14 Jul 2014, 08:43 AM

Hi all,
decided to drop the idea using Template. Directly putting my widget in the Window:

 @(Html.Kendo().Window().Name("Details").Title("Customer Details")
                .Visible(false).Modal(true).Draggable(true).Width(900).Height(400).Content(@<text>
                      @(Html.Kendo().Calendar().Name("test"))
</text>
           ))

Thanks.

0
Dimo
Telerik team
answered on 15 Jul 2014, 04:09 PM
Hello,

The initial problem will be avoided if you follow the documentation guidelines:

http://docs.telerik.com/kendo-ui/getting-started/using-kendo-with/aspnet-mvc/fundamentals#client-templates

Regards,
Dimo
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Window
Asked by
CH
Top achievements
Rank 1
Answers by
CH
Top achievements
Rank 1
Dimo
Telerik team
Share this question
or