Add Kendo Calendar in Window

3 posts, 0 answers
  1. CH
    CH avatar
    48 posts
    Member since:
    Aug 2010

    Posted 14 Jul 2014 Link to this post

    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. CH
    CH avatar
    48 posts
    Member since:
    Aug 2010

    Posted 14 Jul 2014 in reply to CH Link to this post

    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.

  3. Dimo
    Admin
    Dimo avatar
    8353 posts

    Posted 15 Jul 2014 Link to this post

    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.

     
Back to Top