0

I have a input type like first one. I can get values from inputs using Ajax Post To Controller.

public ActionResult GetirKatalog(RequestModel requestModel)
    {
        ////

    }

 public class RequestModel 
{
    public string Name { get; set; }
    public string SurName { get; set; }
}

I can create more same inputs like the second one using add button. But I can't get values the second one cause the input names changing.

Example :

  • First one input names "Name" "Surname"
  • Second one input names "Name" "Surname" - "Name2" "Surname2" . . .

How can I request them from Ajax and how can I create model for it ?

Example

  • 1
    Refer the answers [here](http://stackoverflow.com/questions/28019793/submit-same-partial-view-called-multiple-times-data-to-controller/28081308#28081308) and [here](http://stackoverflow.com/questions/40539321/partial-view-passing-a-collection-using-the-html-begincollectionitem-helper/40541892#40541892). And the parameter in your method needs to be `IEnumerable` if you want to post a collection –  Jun 13 '17 at 08:58
  • Basic - you need to make array object from client side then pass to action method List – Asif Raza Jun 13 '17 at 09:00
  • I will try and give you answer. Thanks :) – Ömür Can Yurdugül Jun 13 '17 at 09:08

0 Answers0