How to post list model again to controller with multiple values.
how can i post this model again to controller and what will the column according to this posted model.
@model List<LMGC_Fee.Models.FeeStructure>
<div style="padding-left:20px">
@if (Model.Count > 0)
{
<p class="heading1">
<i class="fa fa-user"></i>General Charges</p>
for (var i = 0; i < Model.Count(); i++)
{
if (Model[i].IsGeneral)
{
<div class="col-md-3">
@Html.DisplayFor(m => m[i].FeeHead)<br />
@Html.TextBoxFor(m => m[i].Fee, new { @class = "form-control", @Placeholder = "0.00" })
@Html.ValidationMessageFor(m => m[i].FeeHeadId)
</div>
}
}
<br /><br /><br /><br /><br /><br /><br /><br />
<p class="heading1">
<i class="fa fa-user"></i>Other Charges</p>
for (var i = 0; i < Model.Count(); i++)
{
if (Model[i].IsOther)
{
<div class="col-md-3">
@Html.DisplayFor(m => m[i].FeeHead)
@if (Convert.ToString(Model[i].Frequency) == "One Time")
{
@Html.DropDownListFor(m => m[i].Month, (IEnumerable<SelectListItem>)ViewBag.Months, "Month", new { @class = "form-control", @style = "width:25% !important;" })
@Html.TextBoxFor(m => m[i].Fee, new { @class = "form-control", @Placeholder = "0.00", @style = "width:25% !important;" })
}
@if (Convert.ToString(Model[i].Frequency) == "Quarterly")
{
for (int j = 0; j < 2; j++)
{
@Html.DropDownListFor(m => m[i].Month, (IEnumerable<SelectListItem>)ViewBag.Months, "Month", new { @class = "form-control", @style = "width:25% !important;" })
@Html.TextBoxFor(m => m[i].Fee, new { @class = "form-control", @Placeholder = "0.00", @style = "width:25% !important;" })
}
}
@Html.ValidationMessageFor(m => m[i].FeeHeadId)
</div>
}
}
<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />
<p class="heading1">
<i class="fa fa-user"></i>Optional Charges</p>
for (var i = 0; i < Model.Count(); i++)
{
if (Model[i].IsOptional)
{
<div class="col-md-3">
@Html.DisplayFor(m => m[i].FeeHead)
@Html.TextBoxFor(m => m[i].Fee, new { @class = "form-control", @Placeholder = "0.00" })
@Html.ValidationMessageFor(m => m[i].FeeHeadId)
</div>
}
}
}
else
{
<br />
<div class="col-md-3">
<b style="color:red; font-size:20px"> No Data Found. </b>
</div>
}
</div>
public class FeeStructure
{
public int FeeHeadId { get; set; }
public string FeeHead { get; set; }
public Boolean IsGeneral { get; set; }
public int AcadYearId { get; set; }
public int ClassId { get; set; }
public Boolean IsOther { get; set; }
public Boolean IsOptional { get; set; }
public string Month { get; set; }
[Required(ErrorMessage = "Select")]
public string Frequency { get; set; }
public string Fee { get; set; }
}