The parameter conversion from type 'System.String' to type ''X' failed because no type converter can convert between these types

前端 未结 4 1423
闹比i
闹比i 2021-01-01 10:35

I\'m stumped with this one and your help would be most appreicated.

I get the error:

The parameter conversion from type \'System.String\' to t

4条回答
  •  长情又很酷
    2021-01-01 10:43

    I had the same name for the parameter on the GET method

    [HttpGet]
    public ActionResult Create(int OSSB)
    

    .. and a property from Faturamento model, that was used on the POST method

    [HttpPost]
    public ActionResult Create(Faturamento model)
    

    Just like this..

    public class Faturamento {
            [Column("ID_OSSB")]
            public virtual int ID_OSSB { get; set; }
            [ForeignKey("ID_OSSB")]
            public virtual OSSB OSSB { get; set; }
            ...
    }
    

    What solved for me was changing the GET parameter name:

    [HttpGet]
    public ActionResult Create(int IDOSSB)
    

提交回复
热议问题