C# 使用asp.net和SQL Server将动态创建的dropdownlist和textbox值保存到数据库

C# 使用asp.net和SQL Server将动态创建的dropdownlist和textbox值保存到数据库,c#,asp.net,sql-server,C#,Asp.net,Sql Server,我有一个使用jQuery的下拉框和文本框,我正在动态创建它们 <table id="input" border="0" align="center" style="width: 55%"> <tr> <td width="20%" align="left"><strong>Item Name</strong></td> <td width="20%" align="left"><strong>Pric

我有一个使用jQuery的下拉框和文本框,我正在动态创建它们

<table id="input" border="0" align="center" style="width: 55%">
<tr>
<td width="20%" align="left"><strong>Item Name</strong></td>
<td width="20%" align="left"><strong>Price</strong></td>
<td width="20%" align="left"><strong>Quantity</strong></td>
<td width="20%" align="left"><strong>Total</strong></td>
<td width="20%" align="left"><strong>Action</strong></td>
 </tr>
<tr class="input_fields_nominee" >
<td>
<asp:DropDownList ID="ddlCustomers1" runat="server" Height="16px" name="ddlCustomers1[]" onchange="get_Price(this.id)" Width="156px">
</asp:DropDownList>
</td>
<td><asp:TextBox ID="TxtPrice1" calss="txtSalesPerson" name="TxtPrice1[]" runat="server"></asp:TextBox></td>
<td><asp:TextBox ID="Txtquantity1" runat="server" name="Txtquantity1[]" onkeyup="set_total_price(this.id)" AutoComplete="off"></asp:TextBox></td>
<td><asp:TextBox ID="TxtTotal1" name="TxtTotal1[]" runat="server"></asp:TextBox></td>                             
<td>
<input type="button" value="Add"  id="btn_add1" class="add_field_button_nominee" />&nbsp;
<input type="button" value="Remove" id="btn_remove1" class="remove_field_nominee" />
</td>
</tr>
</table>

项目名称
价格
数量
总计
行动

单击“添加”按钮时,将动态创建一行

<table id="input" border="0" align="center" style="width: 55%">
<tr>
<td width="20%" align="left"><strong>Item Name</strong></td>
<td width="20%" align="left"><strong>Price</strong></td>
<td width="20%" align="left"><strong>Quantity</strong></td>
<td width="20%" align="left"><strong>Total</strong></td>
<td width="20%" align="left"><strong>Action</strong></td>
 </tr>
<tr class="input_fields_nominee" >
<td>
<asp:DropDownList ID="ddlCustomers1" runat="server" Height="16px" name="ddlCustomers1[]" onchange="get_Price(this.id)" Width="156px">
</asp:DropDownList>
</td>
<td><asp:TextBox ID="TxtPrice1" calss="txtSalesPerson" name="TxtPrice1[]" runat="server"></asp:TextBox></td>
<td><asp:TextBox ID="Txtquantity1" runat="server" name="Txtquantity1[]" onkeyup="set_total_price(this.id)" AutoComplete="off"></asp:TextBox></td>
<td><asp:TextBox ID="TxtTotal1" name="TxtTotal1[]" runat="server"></asp:TextBox></td>                             
<td>
<input type="button" value="Add"  id="btn_add1" class="add_field_button_nominee" />&nbsp;
<input type="button" value="Remove" id="btn_remove1" class="remove_field_nominee" />
</td>
</tr>
</table>


现在,我想将这些值保存到SQL Server数据库。

当您通过javascript动态创建字段时,我认为您唯一的选择是提交表单,然后绑定这些值-可能是通过Request.form,然后从那里保存数据。@AllanS.Hansen您能给我一些示例或链接来帮助我这样做吗仅仅是基本的表单内容:例如:好吧,当你通过javascript动态创建字段时,我认为你唯一的选择是提交表单,然后绑定值——可能是通过Request.Form,然后从那里保存数据。@AllanS.Hansen你能给我一些示例或链接来帮助我这么做吗?这只是基本表单材料:例如: