kendo combo box default selected value

kendo combo box default selected value


Type 1 : MVC code sample

@{
    var TimeZone = new List<SelectListItem>();
    foreach (var item in ViewBag.TimeZoneOffset)
    {
        TimeZone.Add(new SelectListItem() { Text = item.adepTimeZone, Value = item.IDEPTimeZoneID.ToString(), Selected = item.adepTimeZoneOffset.ToString() == @Model.adepTimeZoneOffset ? true : false });
    }
}

@(Html.Kendo().ComboBox()
    .Name("IDEPTimeZoneID")
    .Filter("contains")
    .Placeholder("Select TimeZone...")
    .HtmlAttributes(new { style = "width:320px" })
    .DataTextField("Text")
    .DataValueField("Value")
    .BindTo(TimeZone)
    .SelectedIndex(3)
    .Suggest(true)
)

Type 2 : JavaScript code sample

    var combo = $("#IDEPLanguageID").data("kendoComboBox");

    combo.value("defaultValue");


ANIL SINGH

Anil Singh is an author, tech blogger, and software programmer. Book writing, tech blogging is something do extra and Anil love doing it. For more detail, kindly refer to this link..
My Blogs - https://code-sample.com and https://code-sample.xyz
My Book1 - BEST SELLING ANGULAR BOOK (INCLUDING ALL VERSIONS 2, 4, 5, 6, 7)
My Book2 - ANGULAR 2 INTERVIEW QUESTIONS BOOK - Both Books are Available on WorldWide.

www.code-sample.com/. Powered by Blogger.