use mvc for checked chekbox record insert

Last Reply on Jan 14, 2014 03:05 AM By Mudassar

Posted on Jan 14, 2014 03:04 AM

when i click on button below the grid then selected checkbox  records in grid  inserted in database

using edmx and mvc2

<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<IEnumerable<MvcApplication1.Models.Employee>>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    Index
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <h2>
        Index</h2>
    <table>
        <tr>
            <th>
            </th>
            <th>
                FirstName
            </th>
            <th>
                LastName
            </th>
            <th>
                ID
            </th>
            <th>
                Designation
            </th>
            <th>
                cheked
            </th>
        </tr>
        <% foreach (var item in Model)
           { %>
        <tr>
            <td>
                <%: Html.ActionLink("Edit", "Edit", new { id=item.ID }) %>
                |
                <%: Html.ActionLink("Details", "Details", new { id=item.ID })%>
                |
                <%: Html.ActionLink("Delete", "Delete", new { id=item.ID })%>
            </td>
            <td>
                <%: item.FirstName %>
            </td>
            <td>
                <%: item.LastName %>
            </td>
            <td>
                <%: item.ID %>
            </td>
            <td>
                <%: item.Designation %>
            </td>
            <td>
                <input type="checkbox" name="ContentTypeFilter" value="@rowContent[0]" />
                <%: Html.CheckBox("Check",false,new {id=item.ID}) %>
            </td>
        </tr>
        <% } %>
    </table>
    <p>
    <input type="submit" name="submit" value="submit" />
    </p>
    <p>
        <%: Html.ActionLink("Create New", "Create") %>
    </p>
</asp:Content>

 

Posted on Jan 14, 2014 03:05 AM

Refer

http://www.ienablemuch.com/2011/07/using-checkbox-list-on-aspnet-mvc-with_16.html