User Control Example wanted!

D

Duncan Welch

Does anyone know where I can find some example code of a user control that
contains dynamnically created text boxes of which the value can be retrieved
once the page has been submitted?

I think it's the OnInit process that I'm stuck on.

Thanks in advance,

Dunc
 
D

Duncan Welch

I've created the control fine, it displays fine. The ID and the value are
set correctly. The only thing I can't do is read what value the user has
entered in any textboxes, etc after they've submitted the page that has my
user control built dynamically on.

Dunc
 
J

Jos Branders

Duncan Welch said:
I've created the control fine, it displays fine. The ID and the value are
set correctly. The only thing I can't do is read what value the user has
entered in any textboxes, etc after they've submitted the page that has my
user control built dynamically on.

Make sure to recreate your dynamic controls during page_load
before reading the user input, because you can't read values
out of controls that are not there anymore.
Also make sure to use the same ID's again.

When you don't really need the controls again after postback,
still create them, but make them invisible.
 

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
474,079
Messages
2,570,573
Members
47,205
Latest member
ElwoodDurh

Latest Threads

Top