Cannot convert lambda expression to type 'string' because it is not a delegate type

前端 未结 5 1659
生来不讨喜
生来不讨喜 2021-02-19 05:32

In my controller i am trying to use include with EF4 to select related entities, but the lambda expression is throwing the following error,

i have the related entity de

5条回答
  •  悲哀的现实
    2021-02-19 06:07

    If you are getting this error in Razor:

    Ex:

    @Html.RadioButtonFor(model => model.Security, "Fixed", new { @id = "securityFixed"})
    

    C# doesn't know how to convert the string to valid bool or known type.

    So change your string as below:

    @Html.RadioButtonFor(model => model.Security, "True", new { @id = "securityFixed"}) 
    

    or

    @Html.RadioButtonFor(model => model.Security, "False", new { @id = "securityFixed"})    
    

提交回复
热议问题