I recently started to use a viewModel. Here's the viewModel I am using:
public class ContentViewModel
{
public Content Content { get; set; }
public bool UseRowKey {
get {
return Content.PartitionKey.Substring(2, 2) == "05" ||
Content.PartitionKey.Substring(2, 2) == "06";
}
}
public string TempRowKey { get; set; }
}
I changed my razor views from:
@model WebUx.Content
<div class="colx2-left">
<label for="complex-fr-url" class="required">Order</label>
@Html.TextBoxFor(model => model.Order)
</div>
to:
@model WebUx.Areas.Admin.ViewModels.Contents.ContentViewModel
<div class="colx2-left">
<label for="complex-fr-url" class="required">Order</label>
@Html.TextBoxFor(model => model.Content.Order)
</div>
Now my views fail with the following message:
Compiler Error Message: CS0411: The type arguments for method System.Web.Mvc.Html.InputExtensions.TextBoxFor TModel,TProperty> (System.Web.Mvc.HtmlHelper<TModel>, System.Linq.Expressions.Expression<System.Func<TModel,TProperty>>) cannot be inferred from the usage. Try specifying the type arguments explicitly.
Can someone give me advice about what I should do?