Custom plugin - error - does not contain a definition for 'LabelFor'

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
7 лет назад
Compiler Error Message: CS1928: 'System.Web.Mvc.HtmlHelper<Nop.Plugin.MyPlugin.Models.MyModel>' does not contain a definition for 'LabelFor'

@model MyModel
@using Nop.Web.Framework.UI;
@using Nop.Web.Models.Common;
@using Nop.Plugin.MyPlugin.Models;

@Html.HiddenFor(model => model.Id)
<div class="edit-accounttype">
    <div class="inputs">
        @Html.LabelFor(model => model.AccountTypeId, new { }, ":")
...
    </div>

</div>

I've checked my project's web.config and References, and they look similar to that of Payments.Manual (PaymentInfo.cshtml is one of the few out-of-the-box plugins that uses LabelFor)

Thoughts?
7 лет назад
Also complains about   @Html.RequiredHint()
yet, Html.DropDownListFor and  @Html.ValidationMessageFor work fine
7 лет назад
Test it first without parameters.
@Html.LabelFor(model => model.AccountTypeId)

Is above would be working?
7 лет назад
That did it! Thanks.

(I probably don't need the extra params right now, but I'm curious as to why the other overload is not available.  Thoughts?)
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.