C
Col
Hi Guys
I've been having some fun with the following, and hopefully someone
can help out:
I have a UserControl used to display customised Address Fields. The
address fields are just textboxes which are built up dynamically from
values in a table in my database.
The user control queries the database depending on an ID and then
builds these textboxes up. Now, to maintain the state of the textboxes
through postbacks, I was told to put the Dynamic code into the
Page_Init sub in the User Control. This all works fine and the fields
keep state on all my postbacks.
My problem is that I need to pass an ID to the query in the Page_Init
sub in the user control, so that query pulls out the relevant records
only. I can do this through a Public property in the usercontrol
class, but the Page_Init sub in the user control fires before i can
pass anything into it from my Page.
Does anyone know how I can pass this ID into my user control before
the Page_Init sub fires?
AFTER that failed... I moved my Dynamic Code in the User Control from
the Page_Init to the Page_Load sub and have been able to pass my ID to
the user control from my Page with success. And the state is also kept
intact. But now, when I try iterate through the "user control's"
controls to get their values, the Page isnt aware of any child
controls belonging to my Placeholder Control in the user control. I
spose its because they havent been Initialised in Page_Init. (this
part does work if the code is in Page_Init though, but then i have the
first problem mentioned)
Does anyone know what I can do to get either of these methods working?
Thanks alot
Col
I've been having some fun with the following, and hopefully someone
can help out:
I have a UserControl used to display customised Address Fields. The
address fields are just textboxes which are built up dynamically from
values in a table in my database.
The user control queries the database depending on an ID and then
builds these textboxes up. Now, to maintain the state of the textboxes
through postbacks, I was told to put the Dynamic code into the
Page_Init sub in the User Control. This all works fine and the fields
keep state on all my postbacks.
My problem is that I need to pass an ID to the query in the Page_Init
sub in the user control, so that query pulls out the relevant records
only. I can do this through a Public property in the usercontrol
class, but the Page_Init sub in the user control fires before i can
pass anything into it from my Page.
Does anyone know how I can pass this ID into my user control before
the Page_Init sub fires?
AFTER that failed... I moved my Dynamic Code in the User Control from
the Page_Init to the Page_Load sub and have been able to pass my ID to
the user control from my Page with success. And the state is also kept
intact. But now, when I try iterate through the "user control's"
controls to get their values, the Page isnt aware of any child
controls belonging to my Placeholder Control in the user control. I
spose its because they havent been Initialised in Page_Init. (this
part does work if the code is in Page_Init though, but then i have the
first problem mentioned)
Does anyone know what I can do to get either of these methods working?
Thanks alot
Col