Questions tagged [begincollectionitem]

A handy HtmlHelper that was originally authored by Steve Sanderson. It's based on the MVC2 style of converting HTTP POST data into ViewModel collection properties using the out of the box DefaultModelBinder, and is quite helpful when your HTML forms contain collections.

begincollectionitem
Filter by
Sorted by
Tagged with
3 votes
2 answers
425 views

asp.net core Begin Collection Item core not working with kendo controls

I have used BeginCollectionItem in asp.net core. Inside this collection I have used kendo combobox and datepicker both data not bind with model list when post the data. anyone have idea about it. ...
3 votes
1 answer
1k views

Nested List of Lists with BeginCollectionItem

I'm using BeginCollectionItem to add items to an inner list of lists. My question is very similar to the following: Nested BeginCollectionItem, however my the object that contains the list is also a ...
0 votes
1 answer
155 views

Clicking Delete button redirects to Loging page

I am using BeginCollectionItem to dynamically add items to a list. If I attempt click a newly added row, the app immediately halts and redirects me to the login page. If I delete an item that ...
0 votes
0 answers
103 views

Div is Not Removed with jQuery after ajax POST to MVC Controller

I am using BeginCollectionItem to dynamically add items (in this case, Comments) to a list. In attempting to "remove" an item I have run into an issue. I can remove an 'existing' item from ...
0 votes
1 answer
356 views

HTM BeginCollectionItem returns only first item of collection

I have the following problem: A collection of "Gifts" gets passed as a parameter to a view. Each item inside this collection is a object from the Model class "Gift". There are only ...
0 votes
2 answers
281 views

How do I get HTML form data in Partial View to be serialized when parent view has same model?

I have a view that contains several partial views with different models, all except one, which has the same model as the parent view. The reason being, parent view represents a Risk, and the partial ...
6 votes
5 answers
19k views

System.Web.Mvc.HtmlHelper<ModelName> does not contain a definition for

I am trying to use Steve Sanderson's blog post about editing a variable length list. I've installed the dll via the NuGet package manager and made sure that the namespace is in the Views/web.config ...
1 vote
0 answers
1k views

Why HtmlHelpers.BeginCollectionItem add guid to my items?

Functionality: i want to update viewModel from jquery each time user choose to update PersonList on the view. So if i have a class person : public class Person { public string Name {get;set;} ...
0 votes
1 answer
337 views

Map GET request to Action

I'm trying to validate the progress quantity (and other fields once this works) that belongs to the BeginCollectionItems server side. The request is being sent but the parameter progressQty is not ...
1 vote
0 answers
156 views

MVC BeginCollectionItem helper not binding to model instance within view model

Building a dynamic list in MVC5. Form will post to the controller and I can see the StudentList correctly populated in chrome dev tools but in the controller, the StudentList is empty. Model: ...
2 votes
1 answer
2k views

Using BeginCollectionItem with MVC Core

I don't appear to be having the same issues as most with the implementation of BeginCollectionItem with MVC core, I'm not receiving any of the data. I have this main page that has alot of work on it ...
2 votes
1 answer
913 views

MVC BeginCollectionItem Nested List Indexes not working

I've got a BeginCollectionItem repeater that is working perfectly, however when I try and follow the Joe Stevens blog to add nested lists it doesn't work in the way I expected. I've used the ...
2 votes
1 answer
2k views

MVC BeginCollectionItem Hidden index <li>

I am using BeginCollectionItem HTMLHelper. It works as a charm but it messes up the layout I'm using. BeginCollectionItem renders a <ul> and <li> to hide it's hidden fields (which contains ...
1 vote
1 answer
3k views

MVC BeginCollectionItem

I'm having some issue getting my partial view BeginCollectionItem to save to the database. I have a form which has a dynamic number of "sections" that can be added to the page, and within each of ...
0 votes
0 answers
665 views

Using BeginCollectionItem for adding/deleting Lineitems in MVC5 partialview

I'm trying to add/delete EnquiryLineItems into Quotation View. Tried to follow MVC 5 Dynamic Rows with BeginCollectionItem BeginCollectionItem partial within partial not behaving correctly MVC 5 ...
1 vote
1 answer
2k views

Submit data with dynamically added partial view to the controller using ViewModels not working

I'm adding dynamically items to an Enquiry form. Used partial view to for adding/deleting the items but while submitting the main view the values are not bound. My question is how to do the same. ...
1 vote
1 answer
2k views

Validation not working when using dynamically created PartialViews mvc5

I have a View in which Items ( modelview) created/deleted dynamically using BeginCollectionItem and partialview. The dynamically created view's validation is not firing. Code: MainView : @model ...
0 votes
0 answers
219 views

MVC Ajax call not populating "BeginCollectionItem" string correctly

I have a PartialView that is working properly when called like this: <div id="EmailAddresses"> @foreach (FormEmailMessageEmailAddress toRecipient in Model.ToRecipients) { @Html....
2 votes
1 answer
2k views

Row & column alignment when dynamically adding rows to a html table using BeginCollectionItem in ASP.NET MVC 3 using jQuery

I have the following html table definition in my main view <table id="myDynamicTable" cellpadding="0" cellspacing="0" class="burTable" width="964px"> <thead> <tr>...
1 vote
0 answers
115 views

BeginCollectionItem and FluentValidation

Anyone know if it is possible to use FluentValidation with BeginCollectionItem which appends GUIDs to the field/property names? I was able to set up the validator: RuleForEach(x => x.Insureds)....
1 vote
0 answers
176 views

Why do I get random null items in a collection after model binding?

I'm using the package BeginCollectionItem for ASP MVC. I have a form to create and entity, which has an ICollection property. That property needs to be populated with items dinamically within the form....
1 vote
3 answers
576 views

Show/Hide Logic with BeginCollectionItem

I'm using BeginCollectionItem and I'm trying to figure out how to get each individual collection value to do conditional show/hide logic. For example, if I have the following razor markup: <div ...
0 votes
1 answer
210 views

MVC Remote validation is adding model to url

I have remote validation on a field and it fires but I get a 500 error saying the parameter is null at the controller method is null. What is actually happening is the model name is added to the url, ...
1 vote
0 answers
447 views

MVC 5 - Registering JavaScript events from partial view which uses BeginCollectionItem

I have a partial view which looks like this: @model Whatever.Models.Jobs @using (Html.BeginCollectionItem("JobRecords")) { <tr id="jobRow"> @Html.HiddenFor(m => m.Id) &...
15 votes
1 answer
7k views

A Partial View passing a collection using the Html.BeginCollectionItem helper

I made a small project to understand the answer from Stephen Muecke here: Submit same Partial View called multiple times data to controller? Almost everything works. The javascript adds new fields ...
0 votes
1 answer
312 views

ASP.NET MVC + Retrieving one to many relationship using jQuery Tab

I have a form that has a section where it uses jQuery tab generated by BeginCollectionItem. This is done by one-to-many relationship. I can create multiple tabs within the form and can submit it (...
0 votes
1 answer
1k views

Asp.net mvc updating dropdownlist in parent's page submitted by a modal popup

I have a main page that loads a partial view which is using Html.BeginCollectionItem("employees") because I am using a jQuery tab. (so the user can add more employee forms) Inside of my Employee ...
0 votes
1 answer
3k views

A view to add and remove items from a collection on the same view

I'm creating a View that allows the user to add and remove objects in list in a particular way that the client wants. The user has to be able to add or remove multiple forms on the page before ...
11 votes
1 answer
6k views

Using BeginCollectionItem in ASP.net Core

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 ...
0 votes
0 answers
1k views

Using Html.BeginCollectionItem Properly

I am new to MVC/Razor/Web and am hoping to eventually be able to edit a list of items, right now I am just trying to display these items using Html.BeginCollectionItem and it is not working (no error, ...
0 votes
1 answer
294 views

HtmlBeginCollectionItem Get Current Item

I need: Acess /Client/Create Add dynamically Partial Views (/Product/Card) and bind them to Client.Products In each Partial View when i click in a button open a bootstrap modal windows where i can ...
1 vote
0 answers
616 views

Couldn't bind properly from view to model using BeginCollectionItem with nested collection

I am following this blog Editing a variable length list, ASP.NET MVC 2-style by Steven Anderson and started using Html.BeginCollectionItem() for my ASP.NET MVC project. The project is about ...
0 votes
1 answer
1k views

Passing a list to partialview, BeginCollectionItem()

I want to pass a list to PartialView that has BeginCollectionItem(). Here is the code, InquiryOrderViewModel public class InquiryOrderViewModel { public InquiryOrder InquiryOrder { get; set; } ...
0 votes
1 answer
247 views

BeginCollectionItem() gives only lastly appended item for PostBack

InquiryOrderViewModel public class InquiryOrderViewModel { public InquiryOrder InquiryOrder { get; set; } public List<InquiryOrderDetail> InquiryOrderDetails { get; set; } } ...
10 votes
1 answer
9k views

AccessViolationException was unhandled

I'm attempting to use Steve Sanderson's blog post in order to edit a variable length list in my ASP MVC 3 view. The project builds fine, however whenever the partial view is rendered the program blows ...
0 votes
1 answer
1k views

@Html.BeginCollectionItem with IValidatableObject and MemberName mismatch

While using @Html.BeginCollectionItem helper by Steven Sanderson I'm trying to validate the collection items on the server side using the IValidatableObject interface. I want to prevent the user from ...