In below link there is add button which allows you to ADD multiple textbox which i am using on my application.
http://jsfiddle.net/cN5SR/200/
Now I want to know how can I bind that array of string value with my ViewModel.
let's say if my property in ViewModel is as below:
Public class MyViewmodel
{
Public string[] players { get; set; }
}
Steven Sanderson wrote a very nice blog post on exactly this subject.
If I did it statically, I would have done it as follows using Razor syntax.
This results in the following markup:
So if you add two inputs using javascript that looks as follows and post it to your controller, the default binder will create an players array with 4 items. I hope you see the patter.
There are some challenges. I have done this before and had a couple issues around deletions. I can't remember the exact issues and what I did to fix it at this point.