Kendo controls inside Kendo Template for GridEdit

3 posts, 0 answers
  1. Stephan
    Stephan avatar
    6 posts
    Member since:
    Nov 2015

    Posted 11 Dec 2015 Link to this post


     Am using Javascript for rendering a Kendo Grid.  In Grid Edit pop up i have a script Template which is an MVC Kendo Template below,

    <script id="popup-editor" type="text/x-kendo-template">                 


    @(Html.Kendo().DatePickerFor(m => m.USReleaseDate).HtmlAttributes(new { @class = "form-control", placeholder = "US Release Date" }).Deferred())                </div>


     Following is my Kendo Editor pop up template code in javascript

    template: kendo.template($("#popup-editor").html())

    which is perfectly rendering values as expected.


    However the problem is, the controls inside the pop up is a plain Html control (<input>) instead of kendo date picker. As i read in the forum, i tried to initialize it below the template like this


    $(function () {         

    var usReleaseDate = $("#USReleaseDate");        

     if (usReleaseDate) {             

    $("#USReleaseDate").kendoDatePicker( {    

     "format": "MM/dd/yyyy",    

     "min": new Date(1900, 0, 1, 0, 0, 0, 0),     

    "max": new Date(2099, 11, 31, 0, 0, 0, 0) });        



    but of no use.  How can i render kendo controls within a popup editor?

  2. Stephan
    Stephan avatar
    6 posts
    Member since:
    Nov 2015

    Posted 11 Dec 2015 in reply to Stephan Link to this post

    I need it especially for Razor syntax, because when i use data-role attribute in the Template (using Html 5) the control is rendering, but it would be great if i get the same in razor syntax where model binding will occur by default
  3. UI for ASP.NET AJAX banner
  4. Rosen
    Rosen avatar
    3214 posts

    Posted 14 Dec 2015 Link to this post

    Hello Stephan,

    I suspect that the widget is not initialized as it is set for deferred initialization. This will result in the need to manually output the initialization scripts, which the not seems to be not done in the template. Instead you should try to substitute the Deferred for ToClientTemplate and see if this makes any difference.

    Similar to the following:

    @(Html.Kendo().DatePickerFor(m => m.USReleaseDate).HtmlAttributes(new { @class = "form-control", placeholder = "US Release Date" }).ToClientTemplate())

    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 Feedback Portal and vote to affect the priority of the items
Back to Top