-1

I have a form with list of records, and there are 2 check box

  1. To skip record from sending
  2. To further work with that record.

I want to send this checkbox value to 2 different method in my mvc controller

  1. SkipRecord() 2)SendTodb()

Issues here is my view code

   <html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>Index</title>
</head>
<body>
    <form id="form" method="post">
        <div class="container" id="heading">
            <div class="col-xs-6 col-md-6 col-lg-6">

                <h2 class="h2Heading">List</h2>
            </div>
        </div>
        <h2></h2>
        <div class="container" id="list">

            <div class="row">
                <div class="col-lg-12">
                    <div class="main clearfix">
                        <table class="table table-hover table-responsive " id="waitingList">

                            <thead>
                                <tr>
                                    <th>Name</th>
                                    <th>Last Updated</th>
                                    <th>DID</th>
                                    <th>OtherId</th>
                                    <th>Status</th>
                                    <th>Remove</th>
                                    <th>Update</th>
                                </tr>
                            </thead>

                            @foreach (var item in Model)
                            {
                        <tr>
                            <td>
                                @Html.DisplayFor(modelItem => item.Name)
                            </td>
                            <td>
                                @Html.DisplayFor(modelItem => item.LastUpdatedTime)
                            </td>
                            <td>
                                @Html.DisplayFor(modelItem => item.DID)
                            </td>
                            <td>
                                @Html.DisplayFor(modelItem => item.OtherId)
                            </td>
                          
                            
                                <td class="text-center">
                                    <span class="label-status label-default">
                                        New
                                    </span>
                                </td>
                            
                            @using (Html.BeginForm(new { action = "SkipRecord" }))
                            {
                                <td>
                                    @Html.HiddenFor(modelItem => item.ID)
                                    <input id="checkbox" name="skipRecords" value="@item.ID" type="checkbox" />
                                </td>
                            }

                        </tr>


                            }

                        </table>
                        <div class="col-md-offset-2">

                            <button type="submit" class="btn btn-danger btn-md pull-left loginbtn">Update</button>

                        </div>
                    </div>
                </div>
            </div>
        </div>
        </form>
</body>
</html>
  1. I want to try and not use ViewModel
  2. I want to pass checkedvalue and Unchecked value with the record id. because there are 2 different methods if use @using(Html.BeginForm) and pass the method it will only take one method but i want to send data to 2 different methods. please if anyone can help?
Vivek
  • 15
  • 6

1 Answers1

0

Just call the second method from the first. You could create a new method called ProcessChecks or something like that that uses logic to determine which method to send the data to.

What Mark said in the comments is also true; you can't have one form element inside another.

Caleb George
  • 234
  • 1
  • 10