Get a template error when I try to do this?

前端 未结 6 1067
夕颜
夕颜 2020-12-17 10:10

I am using asp.net mvc 3 and I keep getting this error and I don\'t understand it since I am not using a template.

I have this in my partial view

@mo         


        
6条回答
  •  情深已故
    2020-12-17 10:40

    You are misleading the application by passing a method in the parameter of textboxfor instead of passing an expression.

    You had :

    @Html.TextBoxFor(x => x.Due.ToShortDateString())
    

    Store your result in a variable and then use an expression. Try this

    var shortDate = Model.Due.ToShortDateString();
    @Html.TextBoxFor(x => shortDate )
    

提交回复
热议问题