A
Andrea Williams
When I step through my code, the ASPX Page_Load happens before the Page_Load
in the User Control. This means that the property values are not set to
their defaults yet in the User Control and all the properties are blank. So
my question is, where is the best place to put the code that handles the
form. I was hoping to put it in the Page_Load on the ASPX page. Since the
properties aren't available to the ASPX page at that point, I have only a
few options that I can see.
1) Add all the Insert/Update code to the User Control, which I would rather
not do. I would like to keep the data manipulation out of the User Controls
so that I can use them other places. They are basically formatted forms
with exposed Properties. One problem with the separation idea is that the
Controls where I need to add events need to handled by the file that adds
the Control, unless I'm missing someway of wiring up events in the ASPX file
that happen in the User Control. Haven't seen a way to do that yet.
2) Use Request.Form to get the variables passed in the post. Although I've
found this to be problematic because sometimes the variable is prefixed with
'_ucl' or the User Control's name and a colon and sometimes it's not.
3) Add the manipulation code to and event that happens in the ASPX page.
For a form post I would add an event to the control I'm using for the submit
button.
Anyone care to comment? Give me some new ideas maybe?
Thanks in advance!
Andrea
in the User Control. This means that the property values are not set to
their defaults yet in the User Control and all the properties are blank. So
my question is, where is the best place to put the code that handles the
form. I was hoping to put it in the Page_Load on the ASPX page. Since the
properties aren't available to the ASPX page at that point, I have only a
few options that I can see.
1) Add all the Insert/Update code to the User Control, which I would rather
not do. I would like to keep the data manipulation out of the User Controls
so that I can use them other places. They are basically formatted forms
with exposed Properties. One problem with the separation idea is that the
Controls where I need to add events need to handled by the file that adds
the Control, unless I'm missing someway of wiring up events in the ASPX file
that happen in the User Control. Haven't seen a way to do that yet.
2) Use Request.Form to get the variables passed in the post. Although I've
found this to be problematic because sometimes the variable is prefixed with
'_ucl' or the User Control's name and a colon and sometimes it's not.
3) Add the manipulation code to and event that happens in the ASPX page.
For a form post I would add an event to the control I'm using for the submit
button.
Anyone care to comment? Give me some new ideas maybe?
Thanks in advance!
Andrea