Deferred controls in window

2 posts, 0 answers
  1. Suresh
    Suresh avatar
    6 posts
    Member since:
    May 2020

    Posted 20 Jul Link to this post

    Hello - 
    Can you please explain why the drop-down's or other controls are not loading in Kendo Window if we set the Deferred(). 

    If i remove the Deferred() its working and loading the window properly.

    Any help or pointers ?

    @(Html.Kendo().DropDownList()
            .Name("categories")
            .HtmlAttributes(new { style = "width:100%" })
            .OptionLabel("Select a category...")
            .DataTextField("Text")
            .DataValueField("Value")
            .BindTo(new List<SelectListItem>() {
                new SelectListItem() {
                    Text = "Black",
                    Value = "1"
                },
                new SelectListItem() {
                    Text = "Orange",
                    Value = "2"
                },
                new SelectListItem() {
                    Text = "Grey",
                    Value = "3"
                }
            }).Deferred()
            .Events(e => e.Change("onCategoryChange"))
        )

  2. Aleksandar
    Admin
    Aleksandar avatar
    206 posts

    Posted 22 Jul Link to this post

    Hello Suresh,

    By default, the Telerik UI HTML Helpers for ASP.NET MVC output the widget initialization script immediately after the HTML markup of the widget. In scenarios where deferred initialization is required the .Deffered() configuration method is used. Note that the Deferred() configuration method needs to be the last method called in the HTML helper:

    @(Html.Kendo().DropDownList()
            .Name("categories")
            .HtmlAttributes(new { style = "width:100%" })
            .OptionLabel("Select a category...")
            .DataTextField("Text")
            .DataValueField("Value")
            .BindTo(new List<SelectListItem>() {
                new SelectListItem() {
                    Text = "Black",
                    Value = "1"
                },
                new SelectListItem() {
                    Text = "Orange",
                    Value = "2"
                },
                new SelectListItem() {
                    Text = "Grey",
                    Value = "3"
                }
            })
            .Events(e => e.Change("onCategoryChange"))
            .Deferred()
        )

    When the initialization of a widget is deferred the DeferredScripts() method should be called. As a result, all previously deferred initialization statements are output.

    @Html.Kendo().DeferredScripts()

    You can find additional details in the Deferred Initialization section of the documentation.

    Regards,
    Aleksandar
    Progress Telerik

Back to Top