Full error text:
The type arguments for method 'System.Web.Mvc.Html.DisplayExtensions.DisplayFor<TModel,TValue>(System.Web.Mvc.HtmlHelper<TModel>, System.Linq.Expressions.Expression<System.Func<TModel,TValue>>)' cannot be inferred from the usage. Try specifying the type arguments explicitly.
It just recently started happening, though I don't believe I made any changes that would affect this functionality. It throws VS intellisense error, but the pages function just fine.
Html helpers that are not "For" helpers work just fine, it's only the ones that contain these expressions.
The offending markup(1 example of 100s):
<%: Html.DisplayFor(model => model.PortfolioName) %>
Page Directive:
<%@ Page Language="C#" Inherits="ViewPage<My.Namespace.PortfolioViewModel>" %>
View Model:
namespace My.Namespace
{
public class PortfolioViewModel
{
[Required(ErrorMessage = " ")]
[DataType(DataType.Text)]
[DisplayName("Portfolio Name:* ")]
public string PortfolioName { get; set; }
}
}
It sounds stupid, I know, but have you tried closing and reopening VS?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With