How can we access a text box in a "sub" that has been created in another "sub" dynamically

L

loga123

Hi All,

I am new to .net. I am creating a text box in a "button1" "click
event" dynamically based on user input. Name of the text box and ID of
the text box contro are set dynamically in the server side code.
How can make this text box accessable in another "sub" or "button2"
click event?
Any help is greatly appreciated.'

thanks
 
L

Lau Lei Cheong

If you know the ID, you can use Page.FindControl() to find it out and cast
it using CType().

Alternatively, if you just need the TextBox's value, you can just use
Request.Form["The control ID"] to retrieve.
 

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

Forum statistics

Threads
473,754
Messages
2,569,525
Members
44,997
Latest member
mileyka

Latest Threads

Top