@foreach (var item in b)
{
itemCount++;
<input type="hidden" name="class@(itemCount.ToString())" value="@item.CouseClassId" />
<input type="hidden" name="item@(itemCount.ToString())" value="@item.AnotherId" />
}
and the html will be like:
<input type="hidden" name="class1" value="123" />
<input type="hidden" name="item1" value="456" />
<input type="hidden" name="class2" value="789" />
<input type="hidden" name="item2" value="1011" />
My Controller:
[HttpPost]
public ActionResult CarAddStudent(object model) {
return View("Another");
}
In the method's controller, how did I declare the model type and I will receive the dynamic value from Razor?