简体   繁体   中英

ASP.NET MVC Html.CheckBoxListFor is missing / compiler error

I'm trying to add a list of checkbox items for a legacy ASP.NET MVC application.

Like this and this .

Given the following code, I get the following error:

<td>@if (Model != null)
    {
        @Html.CheckBoxListFor(model => new[] { "yo" }, new[] { "hi" } );
    }
</td>

在此处输入图像描述

Can anyone explain why this is missing / unable to be found?

When I click F12 on Html in the code, this is the assembly/version of MVC:

在此处输入图像描述

  • project is .NET Full Framework 4.8
  • MVC = nuget package Microsoft.AspNet.Mvc 5.2.7

Furthermore, when I try searching for CheckBoxListFor in the MS docs, there's nothing returned. When i search for CheckBoxFor there are results.

So does CheckBoxListFor even exist any more for ASP.NET MVC 5?

It is not supported anymore on MVC 5.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM