Using BeginCollectionItem in ASP.net Core
Asked Answered
L

1

11

I cannot use BeginCollectionItem by Steve Anderson in asp.net core. I got an error in my partial view when I use

@using (Html.BeginCollectionItem("Entries")) 
{

}

The type 'HtmlHelper' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.

is there an alternative way to achieve the functionality of BeginCollectionItem in ASP.net core?

Leopold answered 10/8, 2016 at 5:28 Comment(0)
L
19

I ported the original BeginCollectionItem to work with ASP.Net Core on .Net Core and .Net Framework 4.6+.

https://www.nuget.org/packages/BeginCollectionItemCore

Leopold answered 15/8, 2016 at 4:42 Comment(2)
Thank you. I've added the package to my project but I'm still not able to use BeginItemCollection. Still says I'm missing a reference in my view. Not sure how I'm supposed to get this working :/Calathus
DanielJackson Add this line in _ViewImports.cshtml : @using HtmlHelpers.BeginCollectionItemCore;Leopold

© 2022 - 2024 — McMap. All rights reserved.