Click here to Skip to main content
15,039,149 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
add new row in grid view on button click is work properly but add new row and also whole row in one column

any one help me ?

C#
$(document).ready(function() {
           $('#<%=BtnNewRow.ClientID %>').bind('click', function(event) {
               debugger;
               event.preventDefault();
               var rowCount;
               rowCount = $('#gvRetailOrder tr').length;


               $("[id*=gvRetailOrder] tr").not($("[id*=gvRetailOrder] tr:first-child"));

                   var row = $("[id*=gvRetailOrder] tr:last").after().clone(true);
                   $("td", row).eq(0).val($(this).find("").text());
                   $("td", row).eq(1).val($(this).find("").text());
                   $("td", row).eq(2).html($(this).find("").text());
                   $("td", row).eq(3).html($(this).find("").text());
                   $("td", row).eq(4).html($(this).find("").text());
                   $("td", row).eq(5).html($(this).find("").text());
                   $(".textqty", row).val($(this).find("").text());
                   $(".textRate", row).val($(this).find("").text());
                   $("td", row).eq(8).html($(this).find("").text());
                   $("td", row).eq(9).html($(this).find("").text());
                   $("td", row).eq(10).html($(this).find("").text());
                   $("td", row).eq(11).html($(this).find("").text());
                   $("td", row).eq(12).html($(this).find("").text());
                   $("td", row).eq(13).html($(this).find("").text());
                   $("td", row).eq(14).html($(this).find("").text());
                   $("td", row).eq(15).html($(this).find("").text());
                  $("[id*=gvRetailOrder]").append(row);

           });
       });
Posted
Updated 22-Sep-15 23:50pm
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900