I have a button to clone a textbox, which allow the user to type in too
jquery
function generateRow() {
if (totalans == 9) {
$('#<%= label2.ClientID %>').html('<b>Maximum of 10 answers per questions reached</b>');
}
else {
totalans = totalans + 1; // same as totalans++;
$("#ans").clone().attr({id: "ans_clone_" + totalans, name: "ans_clone_" + totalans}).prependTo("#ans2");
// then you can loop through each input using the totalans variable.
}
Now, I have no idea on how to retrieve those textbox in codebehind c#.
As I want to store it inside the database.
I have got some help from someone here, but it still couldnt help me.
for(x=0; x<totalans; x++){ var tVal = $('#ans_clone_' + x).val(); //process }
im using vs2010, DotNet.
Add
HiddenFieldserver control onto page and use it to store count of dynamically added textboxes. Then, on post back parse it’s value and fetch dynamically added textboxes values fromRequest.Paramscollection:Code-behind: