Q:

To insert dynamically added rows to Database

In the below code I have html table with textbox and dropdown and I'm adding new row dynamically and I want to store all the values using ajax but when I click submit button the rows get disappear. Please help me to resolve the issue.
Javascript:
function MyFunction() {
    $.ajax({
        type: "POST",
        url: "New.aspx/InsertData",
        data: "{'Quantity':'" + $("#<%=txtQty.ClientID%>").val() + "','ProductID':'" + $("#<%=ddlProduct.ClientID%>").val() + "'}",
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        async: "true",
        cache: "false",
        success: function(msg) {
            alert("Success");
            // On success                 
        },
        Error: function(x, e) {
            alert("Fail");
            // On Error
        }
    });
}

Html:
<input type="button" value="Add Row" onclick="addRow('dataTable')" />

<input type="button" value="Delete Row" onclick="deleteRow('dataTable')" />

<table id="dataTable" width="350px" border="1" runat="server">
    <tr>
        <td>
            <input id="checkbox" type="checkbox" name="chk" runat="server" />
        </td>
        <td>
            <input type="text" name="txt" id="txtQty" runat="server" />
        </td>
        <td>
            <asp:DropDownList ID="ddlProduct" runat="server" Style="width: 100%; height:23px"></asp:DropDownList>

        </td>
    </tr>
</table>

<asp:Button ID="Button1" Text="Save New" type="submit" OnClientClick="MyFunction()" runat="server"></asp:Button>

C#:
[WebMethod]
public static void InsertData(string Quantity, string ProductID)
{
        MastersClient Uinsert = new MastersClient();

        Dictionary<string, string> UnitVal = new Dictionary<string, string>();
        UnitVal.Add("Quantity", Quantity.ToString());
        UnitVal.Add("Product", ProductID.ToString());

        Uinsert.InsertUnitTypeDetails(UnitVal); 
}

A:

Try like this - 
<asp:Button ID="Button1" Text="Save New" type="submit" ClientIDMode="Static" runat="server"></asp:Button>

And JavaScript like this- 
 $(function () {
       $("#Button1").click(function (event) {

            // Prevents Form Submission as you want to save data via AJAX
            event.preventDefault();

            $.ajax({
                type: "POST",
                url: "New.aspx/InsertData",
                data: "{'Quantity':'" + $("#<%=txtQty.ClientID%>").val() + "','ProductID':'" + $("#<%=ddlProduct.ClientID%>").val() + "'}",
               contentType: "application/json; charset=utf-8",
               dataType: "json",
               async: "true",
               cache: "false",
               success: function (msg) {
                   alert("Success");
                   // On success                 
               },
               Error: function (x, e) {
                   alert("Fail");
                   // On Error
               }
           });
       });
   })

and make sure you pulling Dynamic data by dynamic Control ID on -
data: "{'Quantity':'" + $("#<%=txtQty.ClientID%>").val() + "','ProductID':'" + $("#<%=ddlProduct.ClientID%>").val() + "'}",

