After searching a lot on below issue. Finally decided to share with you. I have one model.
public class EarlyBirdWeb
{
public string Client { get; set; }
[Display(Name = "Job Name")]
public string JobName { get; set; }
public List<SelectListItem> Reasons { get; set; }
public List<Status> status { get; set; }
public List<ETA> etas { get; set; }
[Display(Name="Call BU")]
public string CallBU { get; set; }
}
I am binding this model to MVC View. My view as follows.
@model List<EarlyBird.Models.EarlyBirdWeb>
<form method="post">
@Html.AntiForgeryToken()
<div class="row">
<table class="table table-bordered table-inverse">
<tr class="bg-warning">
<th>Client
</th>
<th>Job Name
</th>
<th>Reason</th>
<th>Status</th>
<th>ETA</th>
<th>CallBU?
</th>
</tr>
@foreach (var item in Model)
{
<tr>
<td>
@item.Client
@Html.Hidden(@item.Client)
</td>
<td>
@item.JobName
</td>
<td>
@Html.DropDownList("--Select One--", (IEnumerable<SelectListItem>)@item.Reasons)
</td>
<td>
<select>
@foreach (var status in item.status)
{
<option value="@status.StatusName">@status.StatusName</option>
}
</select>
</td>
<td>
<select>
@foreach (var etas in item.etas)
{
<option value="@etas.ETATime">@etas.ETATime</option>
}
</select>
</td>
<td>
@item.CallBU
</td>
</tr>
}
</table>
</div>
<div class="row">
<input type="submit" value="Submit" name="Submit" class="btn btn-warning" />
</div>
</form>
Now, when I fill all details in view and click on submit button, I am getting null in my controller.
So, please assist me how I can get my modified list collection on controller.
Thanks..