【问题标题】:Adding rows and removing rows to table using Jquery in asp.net在 asp.net 中使用 Jquery 在表中添加行和删除行
【发布时间】:2013-10-13 07:53:05
【问题描述】:

我在母版页中有一个表格

表格边框="1" 边框样式="虚线" 宽度="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="(

OnClientClick="JavaScript: 返回 false;" /> >)" OnClientClick="jQuery:add()" />

现在我想通过使用 Jquery Dynamically Asp.net Master Page 单击链接按钮向表中添加行,我正在尝试从两天内没有得到它,任何人都可以帮助我..

【问题讨论】:

    标签: jquery asp.net


    【解决方案1】:

    在 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" />
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-06-12
      • 2013-04-18
      • 2018-01-31
      • 1970-01-01
      • 2016-02-07
      • 2012-11-30
      相关资源
      最近更新 更多