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

Combox Box data soure, how to update different model

2 Answers 55 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Michael
Top achievements
Rank 1
Michael asked on 17 Jun 2013, 07:26 PM
Newie, so be kind...

I have 2 models, People and Projects.

People have ID and Name
Project has 4 differenct People references
PM, LD, Client, SME

People db has 500K records so, viewdata is not an option for combo bind.

Editor template is strongly typed to Project

I have the records selected in the combox from People, but canNOT update the Projects model...

On smaller object, 'Status' selection and bind work great using viewdata. 

How do I do this without using the viewdata bind to?

Code snipet:

Can't get it to work:


@(Html.Kendo().ComboBox()
.Name("ProjectManagerID")  --  in Project model
.DataTextField("EmpName") -- in person model
.DataValueField("EmpID")  - in person model
.Filter("contains")
.MinLength(4)
.HtmlAttributes(new { style = "width: 250px" })
.DataSource(source =>
{
source.Read(read =>
{
read.Action("GetEmployee", "Employee")
.Data("DonAdditionalData");
})
.ServerFiltering(true);
})
)

Works Great:

@(Html.Kendo().DropDownList()
.Name("StatusID")
.DataTextField("StatudsDesc")
.DataValueField("StatusID")
.BindTo((System.Collections.IEnumerable)ViewData["sType"]))

2 Answers, 1 is accepted

Sort by
0
Petur Subev
Telerik team
answered on 20 Jun 2013, 03:48 AM
Hello Michael,

What exactly is not working with the code you shared. Are there JavaScript errors? What is the behavior that you experience. I assume that you will need to set the AutoBind property of the DropDownList to false  - the request will be performed automatically when you enter edit mode since the Grid will try to set the value of the DropDownList.

Basically using Ajax DropDownList in editor templates of the Grid is covered in this code library. I suggest you to take a look and compare with your case. Check the CustomerId editor.

http://www.kendoui.com/code-library/mvc/grid/grid-inline-and-popup-editing-using-cascading-dropdownlists.aspx


Kind Regards,
Petur Subev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Michael
Top achievements
Rank 1
answered on 24 Jun 2013, 01:33 PM
Hello Petur, thanks for the references...  This helped solve my issue...  I was not naming the combobox the same as the field in the model...

Thanks again!
Tags
ComboBox
Asked by
Michael
Top achievements
Rank 1
Answers by
Petur Subev
Telerik team
Michael
Top achievements
Rank 1
Share this question
or