T
Tim Marsden
Hi,
This is what I am doing, please comment if this is the correct way.
I need to add controls to a form dynamically.
Within the Page_Load event (is not Postback) I run a routine to create the
controls, and populate the dropdowns etc,
I use addhandler to define delegates to capture events raised by the
controls.
I store these controls in a hashtable.
I store the hashtables in the session store. (??)
Then also within the Page_Load event (run each time), I repopulate the hash
tables from the session store. I then run a routine to add the controls to
and existing table on the form. (this bit is run every the page is posted as
the controls disappear from the table)
All seems OK so far.
When the form is run, the events fire OK.
However, if I place code within the event to amend properties of design time
controls on the form, the changes are not reflected upon the form when it is
next displayed. Run the same code in a design time control event and all is
OK.
It seems I can amend properties of other dynamic controls but not design
time controls.
Please comment on my methods, and offer advise.
Secondly.
I have placed a data set on the form, and populate this once in the page
load. If I reference the dataset in the dynamic control events it is
populated, if I reference it in the design time control events it is empty.
?????
There seems to be 2 environments, one for design time controls and one for
dynamic controls. I am confused!!
Tim.
I am new to ASP.NET please see my other posts on the subject.
This is what I am doing, please comment if this is the correct way.
I need to add controls to a form dynamically.
Within the Page_Load event (is not Postback) I run a routine to create the
controls, and populate the dropdowns etc,
I use addhandler to define delegates to capture events raised by the
controls.
I store these controls in a hashtable.
I store the hashtables in the session store. (??)
Then also within the Page_Load event (run each time), I repopulate the hash
tables from the session store. I then run a routine to add the controls to
and existing table on the form. (this bit is run every the page is posted as
the controls disappear from the table)
All seems OK so far.
When the form is run, the events fire OK.
However, if I place code within the event to amend properties of design time
controls on the form, the changes are not reflected upon the form when it is
next displayed. Run the same code in a design time control event and all is
OK.
It seems I can amend properties of other dynamic controls but not design
time controls.
Please comment on my methods, and offer advise.
Secondly.
I have placed a data set on the form, and populate this once in the page
load. If I reference the dataset in the dynamic control events it is
populated, if I reference it in the design time control events it is empty.
?????
There seems to be 2 environments, one for design time controls and one for
dynamic controls. I am confused!!
Tim.
I am new to ASP.NET please see my other posts on the subject.