M
multiformity
So I have been working on an opensource project for a while, and
decided to really try to make it look better after focusing on the
functionality most of this time. Up to now, I have simply used a
standard ASPX page with minor modifications to it. All of my pages
inherit from a "BasePage.cs" class, that handles common things like
getting the user's information out of the session, determines if a page
should or should not be password protected, etc. Up until now it has
all been working fine, but if it ain't broke.. FIX IT right?
Thus I decided to attempt to incorporate MasterPages in my Visual Web
Developer Express since it seemed so easy and would give me much more
control over my pages and allow me to reduce extra ASPX content, etc...
wrong unfortunatly.
Briefly my problems are as follows:
1) I need to get rid of the "ctl001$contentPane$" prefix from my form
collection keynames.
2) I need to elliminate redundant properties that would have to exist
in both my BasePage.cs and MasterPage.cs that access login info, etc
from the session.
More detail follows:
1) The first thing I realized is that when I attempted to login, all of
the keys in the Request.Form NameValueCollection had "ctl001$content$"
prepended. I hacked a workaround for this just to see if there were
going to be any other problems, but I would rather NOT have my form
controls prepended with such nonsense, just makes my life more
difficult. I mean, only one server form can exist on a page, why do you
need to specify that it came from a specific content pane, and why is
ctl001 always there if it isn't supposed to change? I mean, this is
going to take another 5 hours to get all working and tested again if I
cannot get rid of this stupid prefix, and it will end up looking VERY
screwey, and I don't want that at all.
2) Again, my BasePage.cs holds userinfo, login status, etc as
properties who's values are actually obtained from the session
underneath. Now it would seem that my MasterPage.cs doesn't have access
to this information, so I would have to put the same properties in the
basepage class in the MasterPage class, so that they can get the info
from the session in a standard way. Then I could have all of the
BasePages actually get the properties from it's masterpage property, or
the code would be redundent otherwise. But this would pose a problem if
there was NO masterpage property of my basepage (IE, a page that didn't
use the masterpage concept). So I am back to having the same property
accessors of the session object repeated in two places. I am really at
a loss for the correct way to fix this. I mean, I am going to have
redundant code in my MasterPage.cs and BasePage.cs file all the ways I
can think of fixing it. I could make some helper class that actually
gets the info from the session that is passed in, but that seems VERY
cludgy, but at least the real guts of the code wouldn't be repeated.
Help help please, I mean, is it supposed to be this difficult to use
MasterPages? Is it realy a situation where you have to use them or not?
What can I do to fix this??
decided to really try to make it look better after focusing on the
functionality most of this time. Up to now, I have simply used a
standard ASPX page with minor modifications to it. All of my pages
inherit from a "BasePage.cs" class, that handles common things like
getting the user's information out of the session, determines if a page
should or should not be password protected, etc. Up until now it has
all been working fine, but if it ain't broke.. FIX IT right?
Thus I decided to attempt to incorporate MasterPages in my Visual Web
Developer Express since it seemed so easy and would give me much more
control over my pages and allow me to reduce extra ASPX content, etc...
wrong unfortunatly.
Briefly my problems are as follows:
1) I need to get rid of the "ctl001$contentPane$" prefix from my form
collection keynames.
2) I need to elliminate redundant properties that would have to exist
in both my BasePage.cs and MasterPage.cs that access login info, etc
from the session.
More detail follows:
1) The first thing I realized is that when I attempted to login, all of
the keys in the Request.Form NameValueCollection had "ctl001$content$"
prepended. I hacked a workaround for this just to see if there were
going to be any other problems, but I would rather NOT have my form
controls prepended with such nonsense, just makes my life more
difficult. I mean, only one server form can exist on a page, why do you
need to specify that it came from a specific content pane, and why is
ctl001 always there if it isn't supposed to change? I mean, this is
going to take another 5 hours to get all working and tested again if I
cannot get rid of this stupid prefix, and it will end up looking VERY
screwey, and I don't want that at all.
2) Again, my BasePage.cs holds userinfo, login status, etc as
properties who's values are actually obtained from the session
underneath. Now it would seem that my MasterPage.cs doesn't have access
to this information, so I would have to put the same properties in the
basepage class in the MasterPage class, so that they can get the info
from the session in a standard way. Then I could have all of the
BasePages actually get the properties from it's masterpage property, or
the code would be redundent otherwise. But this would pose a problem if
there was NO masterpage property of my basepage (IE, a page that didn't
use the masterpage concept). So I am back to having the same property
accessors of the session object repeated in two places. I am really at
a loss for the correct way to fix this. I mean, I am going to have
redundant code in my MasterPage.cs and BasePage.cs file all the ways I
can think of fixing it. I could make some helper class that actually
gets the info from the session that is passed in, but that seems VERY
cludgy, but at least the real guts of the code wouldn't be repeated.
Help help please, I mean, is it supposed to be this difficult to use
MasterPages? Is it realy a situation where you have to use them or not?
What can I do to fix this??