Dear Sir
I have added this JQuery for addition Row in DataGrid. But it's copy the data from 1st Row if it is already filled in row.
How to add a new Blank Row.
<script type="text/javascript">
$(function () {
var gridView = $("[id*=gridInvoice]");
var row = gridView.find("tr").eq(1).clone();
$("[id*=btnAddRow]").click(function () {
var preindex = $(this).parent().parent().prev().find("td").eq(0).html();
$("<tr>" + row.html() + "</tr>").insertBefore(gridView.find("tr:last"));
$(this).parent().parent().prev().find("td").eq(0).html((parseInt(preindex) + 1))
return false;
});
});
</script>
<div class="col-lg-12 with-border table-bordered">
<asp:DataGrid ID="gridInvoice" runat="server" HeaderStyle-BackColor="SlateGray" HeaderStyle-ForeColor="White"
ItemStyle-Font-Size="Small" FooterStyle-Font-Size="Small"
AutoGenerateColumns="false" class="table table-striped table-bordered" Width="100%">
<Columns>
<asp:TemplateColumn HeaderText="EwayBill Number">
<ItemTemplate>
<asp:TextBox ID="txtInvEwayBillNo" runat="server" CssClass=" form-control" Width="180px" MaxLength="12"
AutoPostBack="true" OnTextChanged="txtEwayBillNo_SelectedIndexChanged"
Text='<%#DataBinder.Eval(Container.DataItem,"EWAYBILL_NO")%>'>
</asp:TextBox>
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="EwayBill Valid From">
<ItemTemplate>
<asp:TextBox ID="txtInvEwayFrmDt" runat="server" CssClass=" form-control" Width="120px"
Text='<%#DataBinder.Eval(Container.DataItem,"EWAYBILL_DT")%>'>
</asp:TextBox>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp:DataGrid>
<asp:Button ID="btnAddRow" CssClass="btn btn-sm bg-gray-active" Text="Add Row" runat="server" />
</div>