Combox Box data soure, how to update different model

3 posts, 0 answers
  1. Michael
    Michael avatar
    5 posts
    Member since:
    Feb 2013

    Posted 17 Jun 2013 Link to this post

    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:

    .Name("ProjectManagerID")  --  in Project model
    .DataTextField("EmpName") -- in person model
    .DataValueField("EmpID")  - in person model
    .HtmlAttributes(new { style = "width: 250px" })
    .DataSource(source =>
    source.Read(read =>
    read.Action("GetEmployee", "Employee")

    Works Great:

  2. Petur Subev
    Petur Subev avatar
    1882 posts

    Posted 19 Jun 2013 Link to this post

    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.

    Kind Regards,
    Petur Subev
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. Michael
    Michael avatar
    5 posts
    Member since:
    Feb 2013

    Posted 24 Jun 2013 Link to this post

    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!
Back to Top