I recently started using viewModel. Here is the viewModel that 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 the look of the razor:
@model WebUx.Content
<div class="colx2-left">
<label for="complex-fr-url" class="required">Order</label>
@Html.TextBoxFor(model => model.Order)
</div>
at
@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: Type Arguments for the System.Web.Mvc.Html.InputExtensions.TextBoxFor TModel, TProperty> Method (System.Web.Mvc.HtmlHelper <TModel>, System.Linq.Expressions.Expression <System.Func < TModel, TProperty>); cannot be taken out of use. Try explicitly specifying type arguments.
Can someone give me advice on what I should do?
Alan2 source
share