DropdownList Databinding (BindTo)

1 posts, 0 answers
  1. Yeou
    Yeou avatar
    3 posts
    Member since:
    Sep 2012

    Posted 11 Sep 2012 Link to this post

    ::Edited :: Solved by changing  Inherits="System.Web.Mvc.ViewPage<MVC3TelerikDemo.Models.Department>"

    To

    Inherits="System.Web.Mvc.ViewPage<IEnumerable<MVC3TelerikDemo.Models.Department>>"

    Hi,

    I am new with Telerik and trying to bind Linq.Table to the Kendo Dropdown. Following is the code.

    -------Action Method---------

    public ActionResult DropDownList()
    {
    DepartmentsDataContext context = new DepartmentsDataContext();
    return View(context.Departments);

    --------View Page--------

    <%: Html.Kendo().DropDownList()
    .Name("ddlDept")
    .DataTextField("Name")
    .DataValueField("DepartmentID")
    .BindTo(Model)
    .SelectedIndex(0)
    %>

    I get the following error:  CS1502: The best overloaded method match for 'Kendo.Mvc.UI.Fluent.DropDownListBuilder.BindTo(System.Collections.Generic.IEnumerable<Kendo.Mvc.UI.DropDownListItem>)' has some invalid arguments

    Thank you.

    Yeou

Back to Top