Hi Everyone!
I have to gererate dynamicaly checkbox in MVC 4. How i do this? I have successfuly generated some controls as below code
<table>
@foreach (var item in Model)
{
<tr>
<td>
@*-------------Here i want to put checkbox---------------*@
</td>
<td>
@Html.DisplayTextFor(m => item.Description)
</td>
</tr>
}
</table>
Thanks in advance
AVADHESH PATEL
02-Feb-2013Hi Mark Devid!
You can try this way
<table> @foreach (var item in Model) { <tr> <td> @Html.CheckBox("fileItem") @Html.Hidden("fileId", item.ID) </td> <td> @Html.DisplayTextFor(m => item.Description) </td> </tr> } </table>I hope, above code will be resolve your problem