在asp.net中使用Jquery添加行并删除行

时间:2013-10-13 07:53:06

标签: jquery asp.net

我在Master Page中有一个表格

table border =“1”border-style =“dashed”width =“80%”id =“tblAddBirthdays”                         tr id =“tr”                 td asp:TextBox ID =“txFirstName”runat =“server”asp:TextBox asp:TextBox ID =“txLastName”runat =“server”                 asp:DropDownList ID =“dlMonth”runat =“server”                 asp:DropDownList ID =“dlDate”runat =“server”                 asp:DropDownList ID =“dlYear”runat =“server”                 asp:DropDownList ID =“dlAgeRange”runat =“server”                 asp:DropDownList ID =“dlRelationship”runat =“server”                 asp:DropDownList ID =“dlGender”runat =“server” 和链接按钮             asp:LinkBut​​ton ID =“lnkLess”runat =“server”Text =“(<<<)Less”

OnClientClick =“JavaScript:return false;” />         >)“OnClientClick =”jQuery:add()“/>

现在我想通过点击链接按钮使用Jquery动态Asp.net主页面向表添加行,我试着两天没有得到它,任何身体可以帮助我...... < / p>

1 个答案:

答案 0 :(得分:0)

在ASP.NET中从客户端添加可能无法按预期工作,因为它不会更新ASP.NET webform的视图状态。最好使用UpdatePanel并添加行。在正常的jquery ADD中使用像这样的东西

             var tbl = $("#tableId");
             tbl.appendTo('<tr><td></td></tr>');

您必须使用正常的html字段,例如

            <input type="text" id="txt" name="txt" />