Users Pricing

forum

Home Forums How to get checked value of checkbox in MVC 4 – MindStick

How to get checked value of checkbox in MVC 4

Royce Roy 17517 02 Feb 2013

Hi Everyone!
I have created dynamicaly checkbox in partial view in MVC 4. How to get checked value of checkbox in action when form post. Dynamicaly generated checkbox code as below

@using (Html.BeginForm("AttachmentList", "Home", FormMethod.Post, new
{
    @id = "PDFListDownload"
}))
{
    <div id="PDFAttachmentList">
        <table>
            @foreach (var item in Model)
            {
                <tr>
                    <td>@Html.CheckBox("fileItem")
                        @Html.Hidden("fileId", item.AtttachmentID)
                    </td>
                    <td>@Html.DisplayTextFor(m => item.Description)
                    </td>
                </tr>
            }
            <tr>
                <td>
                    <input id="btnDownload" type="submit" value="Download"  />
                </td>
                <td>
                    <input id="btnCancel" type="button" value="Cancel" onclick="CloseDialog();" />
                </td>
            </tr>
        </table>
    </div>
}

Thanks and regard!


1 Answers

Markdown for AI

A clean, structured version of this page for AI assistants and LLMs.

Open .md