This is a migrated thread and some comments may be shown as answers.

DropdownList Databinding (BindTo)

0 Answers 159 Views
DropDownList
This is a migrated thread and some comments may be shown as answers.
Yeou
Top achievements
Rank 1
Yeou asked on 11 Sep 2012, 06:08 AM

::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

No answers yet. Maybe you can help?

Tags
DropDownList
Asked by
Yeou
Top achievements
Rank 1
Share this question
or