Hi All i am trying to submit HTML table rows which are checked with checkbox in MVC4 razor. but i am unable to submit
i am using below code to bind my table. table is displaying without any issues. Controller Code

       // To get address list with JSon Format
     [AcceptVerbs(HttpVerbs.Get)]
     public ActionResult GetAddressBypostalcode(string postalcode)
     {
         var addresslist = GetAddresslistBYpostcode(postalcode);
         return Json(addresslist, JsonRequestBehavior.AllowGet);
     }

HTML View PartHTML code Jquery

<script type="text/javascript">

    $(document).ready(function () {
       var postcodes = getCookie("postalcodes");
        if(postcodes!="")
        {

        $.ajax({
            cache: false,
            type: "Get",
            url: "/MapView/GetAddressBypostalcode",
            data: { "postalcode": postcodes },
            success: function (data) {
                drawTable(data);
        }

        });
    }

    });

    function drawTable(data) {

        for (var i = 0; i < data.length; i++) {
            drawRow(data[i],i+1);
        }
        $('#personDataTable').paging({ limit: 50 });
    }

    function drawRow(rowData,rowno) {
        var row = $("<tr />")
        $("#personDataTable").append(row); //this will append tr element to table... keep its reference for a while since we will add cels into it
        row.append($("<td>" + rowno + "</td>"));
        row.append($("<td>" + rowData.Address + "</td>"));
        row.append($("<td>" + rowData.addr1 + "</td>"));
        row.append($("<td>" + rowData.addr2 + "</td>"));
        row.append($("<td>" + rowData.addr3 + "</td>"));
        row.append($("<td>" + rowData.counciltaxband + "</td>"));
        row.append($("<td style='display:none;'>" + rowData.postcode + "</td>"));
        row.append($("<td><input  type='checkbox' class = 'chcktbl' checked /></td>"));

    }

How can i post only checkbox checked rows to controller

share|improve this question
    
You have not even given your checkboxes a name attribute or a value attribute so there is nothing that can be posted back – Stephen Muecke Oct 31 '15 at 7:43

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.