Hi everyone,
I am having hard time getting the model binding work with the DropdownList.
* I am not manually setting the name on the widget
* I do not have AutoBind set to false
This is from the telerik demos.
Here is the Controller Code:
The above code would load the dropdownlist, but doesn't set the value on initial load.
I looked through previous post and could not find why this wouldn't work.
Any suggestions on what I might be doing wrong?
I appreciate your time.
Uday
I am having hard time getting the model binding work with the DropdownList.
* I am not manually setting the name on the widget
* I do not have AutoBind set to false
@(Html.Kendo().DropDownListFor(m=> m.SelectedProduct)
.HtmlAttributes(new { style = "width: 250px" })
.DataTextField("ProductName")
.DataValueField("ProductID")
.DataSource(source =>
{
source.Read(read =>
{
read.Action("GetProducts", "DropdownList");
});
})
)
This is from the telerik demos.
Here is the Controller Code:
public
ActionResult RemoteDataSource()
{
var model =
new
RemoteDataSourceViewModel()
{
SelectedProduct =
new
SelectedProduct()
{
ProductID = 7,
ProductName =
"Uncle Bob's Organic Dried Pears"
}
};
return
View(model);
}
The above code would load the dropdownlist, but doesn't set the value on initial load.
I looked through previous post and could not find why this wouldn't work.
Any suggestions on what I might be doing wrong?
I appreciate your time.
Uday