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

MultiSelectList in DropDownList using an assignment and lookup table.

1 Answer 180 Views
DropDownList
This is a migrated thread and some comments may be shown as answers.
Michael
Top achievements
Rank 1
Michael asked on 09 Aug 2016, 11:18 PM

Hi,

  I am having a problem figuring out how to fit an assignment table into the selected values of my DropDownList.  Normally when I am using lookup tables I can set the selected value(single select) easily.  Here we have a one to one as shown below and it works fine as the corresponding model for the header table has one value in a column that is used to select the value from the list(from a lookup table "changeTypeList").  See below

 

Model:

public SelectList changeTypeList = new SelectList((from a in entity.luChange_Type select a.Change_Type_Desc).ToList());

EditorTemplate:

@model DatabaseRepositoryTool.Models.DB_Changes_Header

........

@Html.DropDownListFor(m => m.Change_Type_Desc, Model.changeTypeList)

 

Now I have to add a release MutliSelect DropDownList in the editor template for adding and modifying records.  I need to populate it much in the same way I did above, using a lookup table of all possible values.  Once I have populated it I need to use an assignment table to figure out which ones need to be selected as well as saved.

Schema:

The assignment table holds rows for each release assignment, given to a header record, and has a foreign key "Release_Name" as a key to the lookup tables primary key.  It also stores the header table record's ID to link it to the header table.

Problem:

How do I go about populating the editor template with a MultiSelect DropDownList that is populated by a lookup table while setting the selected values based on the assignment table?  I am using the pop-up editor in a Kendo grid and made a custom editor template for it.

I have no code to show as I cannot find any examples of how to do this.

1 Answer, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 11 Aug 2016, 04:54 PM
Hello Michael,

As you've mentioned, Kendo Grid supports custom popup editor template:
https://github.com/telerik/ui-for-aspnet-mvc-examples/tree/master/grid/custom-popup-editor
http://docs.telerik.com/kendo-ui/aspnet-mvc/helpers/grid/templating/editor-templates

You can also check the multiselect-in-grid and multiselect-in-grid-popup samples provided in the following collection:
https://github.com/telerik/ui-for-aspnet-mvc-examples/tree/master/grid


I hope this will prove helpful.


Regards,
Eyup
Telerik by Progress
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
DropDownList
Asked by
Michael
Top achievements
Rank 1
Answers by
Eyup
Telerik team
Share this question
or