Dynamic Controls in Panel - How to access them!

  • Thread starter Thread starter arun.hallan
  • Start date Start date
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?
 
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.
 
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
 
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
 
Back
Top