Saturday 11 March 2017

MVC - Fix Error - Cannot convert method group 'LabelFor' to non-delegate type 'object'.

Watch this example on YouTube

Error
Error    CS0428    Cannot convert method group 'LabelFor' to non-delegate type 'object'. Did you intend to invoke the method?
Compiler Error Message: CS1503: Argument 1: cannot convert from 'method group' to 'HelperResult'

To fix it replace (remove space)
@Html.LabelFor (model => model.First().LanID)
with
@Html.LabelFor(model => model.First().LanID)

2 comments:

  1. Server Error in '/' Application.
    Compilation Error
    Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

    Compiler Error Message: CS1503: Argument 1: cannot convert from 'method group' to 'HelperResult'

    Source Error:


    ReplyDelete
  2. /

    Line 5: please tell me how can resolve this error

    ReplyDelete