Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Type arguments cannot be inferred from the usage mvc3

I am trying to use the strongly typed view with extensions methods as

<% using (Html.BeginForm()) { %>
    <%: Html.ValidationSummary(true) %>
    <fieldset>
        <legend>MyUsageViewModel</legend>

        <div class="editor-label">
            <%= Html.LabelFor(model => model.test) %>
        </div>   
                              <p>
            <input type="submit" value="Save" />
        </p>
    </fieldset>
<% } %>
    <div>
    <%: Html.ActionLink("Back to List", "Index") %>
</div>

I am getting the following error :

The type arguments for method 'System.Web.Mvc.Html.LabelExtensions.LabelFor(System.Web.Mvc.HtmlHelper, System.Linq.Expressions.Expression>)' cannot be inferred from the usage. Try specifying the type arguments explicitly.

Help would be appreciated

like image 260
Amit Avatar asked Sep 08 '11 08:09

Amit


1 Answers

It seems your model doesn't have 'test' property which you are trying to use in Html.LabelFor helper method.

like image 100
Aleksei Pugachev Avatar answered Sep 17 '22 15:09

Aleksei Pugachev