jquery.clone() and ASP.NET Forms
Posted
by Jeff
on Stack Overflow
See other posts from Stack Overflow
or by Jeff
Published on 2010-06-14T20:27:56Z
Indexed on
2010/06/14
20:32 UTC
Read the original article
Hit count: 121
So I have a page where I would like to be able to add multiple, dynamic users to a record in a database. Here's the rough start page:
<div id="records">
<div id="userRecord">
Name: <asp:TextBox runat="server" ID="objNameTextBox"></asp:TextBox> <br />
Phone Number: <asp:TextBox runat="server" ID="objPhoneNumberTextBox"></asp:TextBox> <br />
</div>
</div>
And the jquery:
$(function () {
$(".button").button().click(function (event) { addnew(); event.preventDefault(); });
})
function addnew() {
$('#userRecord').clone().appendTo('#records');
}
So my question is what do I use within ASP.NET to be able to poll all of the data in the form and add a unique record for each #userRecord div within the #records div? Yes - I should change the userRecord to a class - I will deal with that. This is just simple testing here.
Should I look in JSON for this type of function? I'm not familiar with it but could figure it out if that is indeed my best option. Thanks for the guidance!
© Stack Overflow or respective owner