asp.net mvc - MVC 5 dropdownlist model state false conversion from type 'System.String' to type 'Namespace.Models.Entity' -


im new mvc , starting understand , develop rl (simple) application, im stuck @ creating record,i can't seem able post form contents because of error :

"the parameter conversion type 'system.string' type 'namespace.models.entity'because no converter can make conversion"

on 1 of fields, however, there field dropdownlist work correctly, maybe because 1 of fields navigation relationship in model? model questionnare application , here main question model: (generated ef database first)

    public partial class questioncontent {     public questioncontent()     {         this.questiontranslations = new hashset<questiontranslations>();         this.questionmedicalcategory = new hashset<questionmedicalcategory>();         this.questioncategory = new hashset<questioncategory>();         this.questioncontent1 = new hashset<questioncontent>();     }      public int qitemid { get; set; }     public string language { get; set; }     public string content { get; set; }     public nullable<int> parentqid { get; set; }      public virtual icollection<questiontranslations> questiontranslations {       get; set; }     public virtual icollection<questionmedicalcategory>      questionmedicalcategory { get; set; }     public virtual icollection<questioncategory> questioncategory { get; set; }     public virtual icollection<questioncontent> questioncontent1 { get; set; }     public virtual questioncontent questioncontent2 { get; set; } } 

the category model 1 :

namespace askusonlineprototype.models{ using system; using system.collections.generic;  public partial class questioncategory {     public questioncategory()     {         this.questioncontent = new hashset<questioncontent>();     }      public int categoryid { get; set; }     public string categorydescription { get; set; }      public virtual icollection<questioncontent> questioncontent { get; set; } }} 

my "create" controller (i copied dropdownlist implementation seeing parentqid viewbag selectlist not generate errors in modelstate)

public actionresult create()     {          viewbag.questioncategory = new selectlist(db.questioncategory, "categoryid", "categorydescription"); viewbag.parentqid = new selectlist(db.questioncontent, "qitemid", "content");//generated vs         viewbag.defaultlanguage = "en";         return view();     }      [httppost]     [validateantiforgerytoken]     public actionresult create([bind(include = "language,content,parentqid,questionmedicalcategory,questioncategory")] questioncontent questioncontent)     {         try         {             if (modelstate.isvalid)             {                 db.questioncontent.add(questioncontent);                 db.savechanges();                 return redirecttoaction("index");             }         }         catch (dataexception /* dex */)         {              modelstate.addmodelerror("", "unable save changes. try again, , if problem persists see system administrator.");         }          viewbag.questioncategory = new selectlist(db.questioncategory, "categoryid", "categorydescription");         viewbag.parentqid = new selectlist(db.questioncontent, "qitemid", "content");              viewbag.defaultlanguage = "en";             return view(questioncontent);        } 

and create view (simplified show problem)

@using (html.beginform()) { @html.antiforgerytoken()       @html.labelfor(model => model.questioncategory,"item category")   @html.dropdownlistfor(m => m.questioncategory,null, "select category")   //this dropdownlistfor implementation not generate errors in modelstate         @html.labelfor(model => model.parentqid, "select parent ")              @html.dropdownlistfor(m=>m.parentqid, null," -- none --")           </div>     </div> 

i've researched several questions in , have been addressing problem few days give because of them deal more complex models, or multiselectlists, mean, should simple! question is, know defaultmodelbinder sees these fields (as medicalcategory gives me same problem think addressing 1 fix medicalcategory too, because in model state shows "intended value" example '1' in given chosen questioncategory, so, there should when dropdownlists binds navigation relationship, there need modify modelbinder? if so, please me start understand how form post works these kind of views? similar question mine i've found [mvc model state validation fails on listbox answer seems stretched simple model, nevertheless, if think correct answer, please point me so.

thanks , if dont know answer have idea of should research id appreciate too!

i believe other question referenced spot on. need either build converter complex type or

@html.dropdownlistfor(m => m.questioncategory.categoryid,null, "select category") 

Comments