Dynamic Controls in Panel - How to access them!

A

arun.hallan

My code does the following...

It references a stored procedure and builds a PlaceHolder containing
certain controls, based on the parameters from the stored proc. This is
implemented in it's own class.

On the form, the user can select from a drop down box of many stored
procs. From that, parameter fields are created which the user can
change, in the PlaceHolder, and then added to the Panel on the form.

My problem is, when the user clicks "run" to run the proc, i cannot get
to the parameter fields.

I have read about how asp works, and that dynamic controls are not
'saved'. But i'm not sure what to do to recreate the controls.
Especially as the architecture is as so:

A panel on the form.
A class which extends a PlaceHolder, adds certain controls to it
determined by the stored procedure's parameter types. This placeholder
is added to the panel when the user clicks a new stored proc.
From this i simply want access to the controls to extract the data!

Can anyone help?
 
A

arun.hallan

Not sure if that can help me.

The difference with my problem is that there are a variable amount of
controls, and those controls are not the same.
 
K

Karl Seguin

Have you tried it?

It basically sounds like your problem is that controls are dynamically
added, but on postback they are lost and you cannot get their values.

The control I sent you is a placeholder which automatically reloads dynamic
controls during postback.

As I understand it, you only have 2 choices. Figure out which controls were
dynamically add them and re-add them yourself during INIT, or use a control
like this one that does it for you.

Karl
 
A

arun.hallan

Hi,

Yeh i've added some code to add the controls again.
It works, except i have a little problem now where a variable sometimes
gets changed, and sometimes doesnt - depending on the asp sequence.

Need to figure that out.

Thanks
 

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,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top