0

I am creating an ASP.NET Core MVC application. I have a view that receives a model that has a List<> property.

This is what the view looks like:

@model InfoUpdateModel

<form action="@Url.Action("TakeoverCoverage", "Participant")" id="formTakeoverCoverage" enctype="multipart/form-data" method="post" autocomplete="off">

@for (int index = 0; index < Model.AvailablePlans.AvailablePlansClient.Count; index++)
{
      <input type="text"  asp-for="@Model.AvailablePlans.AvailablePlansClient[index].CoverageRate" class="form-control" value=" @Model.AvailablePlans.AvailablePlansClient[index].CoverageRate" />
       <input id="LastDayPreCobra@(index)" class="form-control datepicker group-date-picker" value=@Model.AvailablePlans.AvailablePlansClient[index].LastDayPreCobra asp-for="@Model.AvailablePlans.AvailablePlansClient[index].LastDayPreCobra">
    ..
    ..//others fields to input data
    ..
}
</form>

<script language="javascript" type="text/javascript">
     $(document).ready(function () {
         FormTakeoverCoverage();
     });

     function FormTakeoverCoverage() {
         $('#formTakeoverCoverage').submit(function (event) {
             event.preventDefault();
             if ($(this).valid()) {
                 var formdata = new FormData($(this).get(0));
                 $.ajax({
                     url: this.action,
                     type: this.method,
                     data: formdata,
                     processData: false,
                     contentType: false,
                     dataType: "json",
                     headers: {
                         "RequestVerificationToken":
                             $('input:hidden[name="__RequestVerificationToken"]').val()
                     },
                     beforeSend: function () {
                     },
                     success: function (result) {
                         }
                         else {
                             }
                     },
                     complete: function () {
                     }
                 }
                 );
             }
             return false;
         });
     }
</script>

The controller looks like this:

[HttpPost("TakeoverCoverage")]
[ValidateAntiForgeryToken]
[ClientWebError(IsPartial = true)]
public async Task<IActionResult> TakeoverCoverage(InfoUpdateModel model)
{}

The view renders all the model's data, 1, 10 or 100 rows.

When I submit the view with less than 63 records, the controller gets the model with the data. But when the model has more then 63 records, the controller receives null in the model.

I have to show 220 in total and breaks in 63 records. I tried returning the first 64 or latest 64 and have the same problem. It is not a data issue.

I do not know if there is a memory issue.

Any ideas?

Thanks

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Diego
  • 2,238
  • 4
  • 31
  • 68

1 Answers1

0

I followed what says here

and add this

  builder.Services.Configure<FormOptions>(x =>
{
    x.ValueCountLimit = 4096;
});

To my program.cs

Diego
  • 2,238
  • 4
  • 31
  • 68