Dear all,
I have a problem with a server binding (I also try a ajax() binding without success).
Here is my model:
Thanks for your help
Sylvain
I have a problem with a server binding (I also try a ajax() binding without success).
Here is my model:
I should have miss something, but what ?Here is mycontrollerpublic
class
PlaceModel
{
public
Guid Id {
get
;
set
; }
public
string
Name {
get
;
set
; }
public
PlaceModel()
{
}
}
End finally, my webpage:namespace
Noolibee.Presentation.Web.SandBox.Controllers
{
public
class
InventoryController : Controller
{
//
// GET: /Inventory/
public
ActionResult Inventory()
{
//Get all places in the database
IInventoryService serviceRepo = ServiceBusinessFactory.Create<IInventoryService>();
List<INV_Place> places = serviceRepo.GetAllPlaces();
//Convert the places to a placeModel (for testing purpose)
List<PlaceModel> placesModel =
new
List<PlaceModel>();
foreach
(INV_Place item
in
places)
{
placesModel.Add(
new
PlaceModel() { Id = item.Id, Name = item.Name });
}
//Return the view with the list of placeModel for the combobox
return
View(placesModel.AsEnumerable<PlaceModel>());
}
}
}
So, the value @Model.Count tells me that there's 1 item, but the combobox is empty.@model IEnumerable<Noolibee.Presentation.Web.SandBox.Models.PlaceModel>
@{
ViewBag.Title =
"Inventory"
;
Layout =
"~/Views/Shared/_Layout.cshtml"
;
}
<h2>Inventory (size = @Model.Count())</h2>
<div>
@(Html.Kendo().ComboBox()
.Name(
"placesDropDownList"
)
.DataTextField(
"Name"
)
.DataValueField(
"Id"
)
.BindTo(Model)
.SelectedIndex(0)
)
</div>
Thanks for your help
Sylvain