Using the ASP.NET MVC Extensions, I am loading a DropDownList with data from the server.
How can I also pass down from the server which of the items in the DDL I would like to be selected? I always need to have at least one item selected and it will most likely not be the first item in the list. Until I fetch the data for the current user, I will not know which item should be selected.
This is my current code:
Thanks,
--John
How can I also pass down from the server which of the items in the DDL I would like to be selected? I always need to have at least one item selected and it will most likely not be the first item in the list. Until I fetch the data for the current user, I will not know which item should be selected.
This is my current code:
@(Html.Kendo().DropDownList()
.Name(
"companies"
)
.HtmlAttributes(
new
{ style =
"width:300px"
})
.DataTextField(
"CompanyName"
)
.DataValueField(
"CompanyId"
)
.Filter(
"contains"
)
.DataSource(source =>
{
source.Read(read => { read.Action(
"GetCompanies"
,
"CommonAjax"
); })
.ServerFiltering(
true
);
})
.Deferred()
)
Thanks,
--John