Click here to Skip to main content
16,019,043 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hello
i have a Kendo ComboBox.in mvc4.
and bind it to database.

my code:
@Html.Kendo().DropDownList().Name("id_team").BindTo(Model.tbl_team.Select(c=>new SelectListItem{Text = c.team, Value = c.id.ToString()}));

but below cods shows in my combobox:

C#
Select Team:
<input data-val="true" data-val-number="The field id_team must be a number." id="id_team" name="id_team" type="text"/> <script> jQuery(function(){jQuery("#id_team").kendoDropDownList({"dataSource":[{"Text":"Barcelona","Value":"1"},{"Text":"manchester united","Value":"2"}],"dataTextField":"Text","dataValueField":"Value"});}); 



why?
of course i use this script and css in header in masterpage(_Layout) :
XML
<script src="@Url.Content("~/Scripts/jquery-1.7.1.min.js")"></script>
<script src="@Url.Content("~/Scripts/jquery-migrate-1.1.1.min.js")"></script>
<script src="@Url.Content("~/Scripts/kendo/kendo.web.min.js")"></script>
<script src="@Url.Content("~/Scripts/kendo/kendo.aspnetmvc.min.js")"></script>


there is no one to help me?
Posted
Updated 29-Jul-13 1:12am
v4
Comments
Ankur\m/ 29-Jul-13 5:40am    
It seems to be a third party tool. It would be better if you post it in their forum. Chances of getting answer their are much higher.
Prasad Khandekar 29-Jul-13 9:11am    
Hello,

You are not specifying the information about bound fields. Use DataTextField and DataValueField attributes. Perhaps you can rewrite your code as

@Html.Kendo().DropDownList()
.Name("id_team")
.DataTextField("Text")
.DataValueField("Value")
.BindTo(Model.tbl_team.Select(c=>new SelectListItem{Text = c.team, Value = c.id.ToString()}));

Regards,
Member 8454063 31-Jul-13 15:11pm    
no it dose'nt work .

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900