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

Deferred controls in window

1 Answer 1716 Views
Window
This is a migrated thread and some comments may be shown as answers.
Suresh
Top achievements
Rank 1
Veteran
Suresh asked on 20 Jul 2020, 03:12 PM

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"))
    )

1 Answer, 1 is accepted

Sort by
0
Aleksandar
Telerik team
answered on 22 Jul 2020, 10:46 AM

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

Tags
Window
Asked by
Suresh
Top achievements
Rank 1
Veteran
Answers by
Aleksandar
Telerik team
Share this question
or