Accessing javascript-generated textboxes with ASP.NET

J

jeroen.bolle

I'm designing a form where the user can decide how many options for a
poll he wants to add. There's a "+" button to dynamically add
textboxes with javascript, without a postback.

How do I access these newly generated <input type="text" id="..." />
elements with ASP.NET to save it to a database?
 
B

bruce barker

pretty trival.

the javascript textbox postback values will be in the Request.Form
collection. the collection key will be the name the javascript gave as the
name of the <input>. if the names is the same for all the controls, the value
will be a comma seperated string of each value. more common is to append a
counter to the end of the same.

it would also be pretty trival to make a server control that dynamically
created a asp:textbox for each of the postback values, and exposed them as
controls. or the control could expose a collection of values.

-- bruce (sqlwork.com)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top