我有一个使用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" />
<input type="button" value="Remove" id="btn_remove1" class="remove_field_nominee" />
</td>
</tr>
</table>
要动态创建它我在下面给出了jQuery脚本
$(window).load(function () {
var max_nominee = 21; //maximum input nominee allowed
var x = 1; //initlal text box count
//--------------------------//
if (x < max_nominee) {
$(".add_field_button_nominee").live('click', function () {
var $tr = $(this).closest('.input_fields_nominee');
var $clone = $tr.clone();
$clone.find(':text').val('');
$clone.find('*').each(function (index, element)
{
var ele_id = element.id;
$('#' + ele_id).attr("id", ele_id + x);
});
$tr.after($clone);
x++;
});
}
});
当我点击添加按钮时,会动态创建一行
现在我想将这些值保存到SQL Server数据库。