0

I have a list of string which is mapped to database in mongodb.

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

The problem is when I get values from database for edit display , the magicsuggest shows "System.Collections.Generic.List`1[System.String] " in the html not the values of the field ?

Shouldn't it automatically display it or do i need to manually split the list to array or something and pass it to magicsuggest ?

knowledgeseeker
  • 1,163
  • 4
  • 15
  • 32
  • how do you bind this list of objects to magicsuggest ? – Beatles1692 Sep 02 '14 at 12:19
  • since i am using asp.net mvc , i just pass model object to view.The view does the rest. – knowledgeseeker Sep 02 '14 at 12:21
  • 1
    I think that magicsuggest gets its data in json. These links might help : http://stackoverflow.com/questions/23942871/solved-magic-suggest-pre-select-multiple-items-from-mvc-model and http://stackoverflow.com/questions/20877978/set-default-selection-to-magic-suggest – Beatles1692 Sep 02 '14 at 12:46
  • So no automatic binding ? i would need to manually push data . – knowledgeseeker Sep 02 '14 at 13:55
  • @Beatles is right. You need to pass your data as an array of JSON elements. Make sure you serialize it in c# before you send it. Check out the tutorial if you haven't already: http://nicolasbize.com/magicsuggest/tutorial.html – Gad Sep 02 '14 at 13:57

0 Answers0