Using Html.RenderPartial() in ascx files

后端 未结 3 1019
走了就别回头了
走了就别回头了 2021-01-01 11:49

I\'m trying to use Html.RenderPartial in acsx file and I\'m getting an error:

Compiler Error Message: CS1973: \'System.Web.Mvc.HtmlHelper\' has no a

3条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-01 12:08

    In case anyone else made the same mistake I did:

    @Model MyViewModel
    

    This will treat your model as dynamic

    @model MyViewModel
    

    This is a correctly strongly typed view. Note the lack of capitalisation!

    Note, that this is Razor, unlike the original question.

提交回复
热议问题