Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Html.BeginCollectionItem("Gifts")) { } Does not exist

Tags:

c#

asp.net-mvc

Can any one please help me .

@model LioM.Models.Gift
@using (Html.BeginCollectionItem("Gifts"))
{

}

this is my MVC5 partial view. It shows an error does not contain a definition for BeginCollectionItem

like image 823
Maruf Ahammed Juwel Avatar asked Feb 29 '16 07:02

Maruf Ahammed Juwel


2 Answers

Install BeginCollectionItem HtmlHelper from nuget:

PM> Install-Package BeginCollectionItem

And make sure it's Namespace is in your view:

@using HtmlHelpers.BeginCollectionItem
like image 102
Backs Avatar answered Nov 05 '22 07:11

Backs


Can also add

<add namespace="HtmlHelpers.BeginCollectionItem" />

to the namespaces in the web.config of the Views folder. Mine was in an "Areas" folder so I needed to add it there.

like image 29
iii Avatar answered Nov 05 '22 07:11

iii