0

I need to link a single page to multiple categories and store the relationship(s) in a database. I want to make this possible by using the MultiSelect widget bundled with Kendo UI Web. CategoryId is the foreign key from the Category table.

In theory, Categories should work in a similar manner to the Tag system here on SO. Is there a recommended method or sample out there to show me how this can be done?

Here's a sample of my Page model:

public int PageId { get; set; }
public string Title { get; set; }

public int CategoryId { get; set; }
public virtual Category Category { get; set; }

I've tried using the following but to no avail:

public List<int> CategoryId { get; set; }

Please note that I'm not using the MVC Server Wrappers and instead using JavaScript for the views. Any help would be greatly appreciated.

nouptime
  • 9,929
  • 5
  • 22
  • 37

1 Answers1

0

Try changing your list items from int to string:

public List<string> CategoryId { get; set; }

See this answer for more details: Kendo Multiselect: Selected values from binded model are not initialized

Community
  • 1
  • 1
Lopo
  • 936
  • 2
  • 11
  • 18
  • Thanks for the reply. I've given it a shot, same problem as using List. The loading icon appears and the categories don't show up. Let me have a closer look at the question you posted. Maybe I should take the ViewModel approach. – nouptime Oct 22 '13 at 00:44