2013-10-13 60 views
0
上的链接按钮添加行表在asp.net

在这里我有一个表:通过点击使用jQuery

  <table border="1" border-style="dashed" width="80%" id='tblAddBirthdays'> 
      <tr> 
      <th>First Name</th> 
      <th>Last Name</th> 
      </tr> 
      <tr id="tr"> 
      <td><asp:TextBox ID="txFirstName" runat="server"></asp:TextBox></td> 
      <td><asp:TextBox ID ="txLastName" runat="server" /></td> 
      <td><asp:DropDownList ID="dlMonth" runat="server" /></td> 
      <td><asp:DropDownList ID="dlDate" runat="server" /></td> 
      <td><asp:DropDownList ID="dlYear" runat="server" /></td> 
      <td><asp:DropDownList ID="dlAgeRange" runat="server" /></td> 
      <td><asp:DropDownList ID="dlRelationship" runat="server" /></td> 
      <td><asp:DropDownList ID="dlGender" runat="server" /></td> 
     </tr> 
    </table> 

和链接按钮:

<asp:LinkButton ID="lnkLess" runat="server" Text="(<<)Less " OnClientClick="JavaScript: return false;" /> 
     <asp:LinkButton ID="lnkMore" runat="server" Text="More(>>)" OnClientClick="jQuery:add()" />& 

我想写jQuery代码添加并删除行的表,我现在尝试两天,它仍然无法正常工作。任何人都可以帮忙吗?

回答

0

更好的事情做的是使用一些客户端pulgin像巴兰说,像数据表或jqGrid的

但如果ü坚持在本地JavaScript有一些接口为 删除行http://www.w3schools.com/jsref/met_table_deleterow.asp 添加一行http://www.w3schools.com/jsref/met_table_insertrow.asp

从这里您的真实任务将把正确的数据放在正确的位置。这些链接中有完整的示例

+0

我可以使用Asp.net Grid Control吗?如果是的话,它是如何完成的,请回复ASAP – user2867963

+0

我的朋友,asp网格呈现一个html表格,所以您可以像使用它一样,唯一的是你的jQuery选择器在选择表名之后需要选择像$(“。mytbl tbody”)这样的tbody; PS你可以在这里窥视,看看我用网格视图做的其他事情,以便你最终会看到它只是一个htmltable http://bresleveloper.blogspot.co.il/search?q=grid。不断询问你是否需要更多帮助 – bresleveloper