Coder Social home page Coder Social logo

saad749 / begincollectionitemcore Goto Github PK

View Code? Open in Web Editor NEW
25.0 25.0 10.0 1.73 MB

This Html Helper leverages the default model binder in ASP.NET MVC Core and higher to materialize viewmodel collection properties from an HTTP POST and is based on Stevens Anderson BeginCollectionItem

Home Page: http://blog.stevensanderson.com/2010/01/28/editing-a-variable-length-list-aspnet-mvc-2-style/

License: MIT License

C# 38.99% HTML 57.24% JavaScript 1.31% CSS 2.46%

begincollectionitemcore's People

Contributors

saad749 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

begincollectionitemcore's Issues

Conditional Validation Using IValidatableObject

I'm using BeginCollectionItem and I need to require a field in my collection depending on the value of another field in my collection. I tried using the built-in IValidatableObject on my class like so:

public class MyViewModel : IValidatableObject
{
	public List<MyCollection> MyCollection { get; set; } = new List<MyCollection>();

	public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
	{
		foreach (var item in MyCollection)
		{
			if (item.Id == null)
			{
				yield return new ValidationResult("Name is required", new[] { "Name" });
			}
		}
	}
}

This logic runs correctly and returns an error if the condition is met, however, the error message is not displayed on the field. Is there a way to make this work or am I going about this the wrong way?

Nested Collections

Hi,
please is there any documentation related to the "nested collections" feature?
Nested items from the initial ViewModel are correctly displayed and posted back, but newly added children are not.
Looking at the generated HTML it appears that the newly added inner children are not decorated with any reference to their parent.
Please, how shoud I solve this issue?
Thanks

Nested Collection causes null reference exception

Hi,

I'm using Visual Studio 2017 and .Net Core 1.1.

When I utilise the library for a nested collection, I'm getting Null Reference Exception error on post.

This is my class hierarchy:

Application => List<_Section>
_Section => List<_Question>
_Question => List<_Question>

Is this an issue?

Server Side Validation Messages Not Displaying

Has anyone tried using this with server side validation? I put a [Required] attribute on one of my properties in my model class and when I go to submit (with client side validation disabled) I can see that the ModelState is not valid. However, the required message does not get added to the view.

If I keep client side validation enabled, the required message does show.

ASP MVC 5 version

Hi, can you also provide an ASP MVC 5 version, theres is one out there but it makes a round trip on every row add.

Thanks

Not working with kendo controls

I have used BeginCollectionItem with kendo controls but not giving proper name to the kendo elements. working fine with other elements. whereas asp.net mvc version for begincollectionitem is working fine but core version is not working.

I have used .Net 5.0 framework.

For more detail I have posted the issue in stackoverflow site.
https://stackoverflow.com/questions/70498065/asp-net-core-begin-collection-item-core-not-working-with-kendo-controls

Found the solution issue with kendo control render and solved and posted solution on above stackoverflow site.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.