M
matt.delvecchio
hello,
i understand the usefulness of having custom base classes when it
pertains to common methods or custom handling of events (say,
overriding all pages OnError and sending out an email of the
exception).
my question perstains to custom properties of a base class. say i write
a base class, and add two new properties to it (example only, not my
actual properties):
- CustomerID
- CustomerName
....would this make sense, if i wanted to be able to use those props
thru out the app ("this.CustomerID"), sorta like using Session
variables? or would it make more sense to just stick w/ Session?
i ask because i tried a test -- created those two new props in my base
class, and then in a page's OnLoad "if (!IsPostBack)" i assigned values
to them. however, on subsequent button events, the props were empty
because they were not assigned to via the OnLoad. hmm. i was hoping
they would retain state.
do i have the wrong idea about using custom props like this? or should
i just stick to using the Session? OR, would it be best to use the
Session only in OnInit, and assign it to these custom props?
just trying to figure the best practice.
thanks!
matt
i understand the usefulness of having custom base classes when it
pertains to common methods or custom handling of events (say,
overriding all pages OnError and sending out an email of the
exception).
my question perstains to custom properties of a base class. say i write
a base class, and add two new properties to it (example only, not my
actual properties):
- CustomerID
- CustomerName
....would this make sense, if i wanted to be able to use those props
thru out the app ("this.CustomerID"), sorta like using Session
variables? or would it make more sense to just stick w/ Session?
i ask because i tried a test -- created those two new props in my base
class, and then in a page's OnLoad "if (!IsPostBack)" i assigned values
to them. however, on subsequent button events, the props were empty
because they were not assigned to via the OnLoad. hmm. i was hoping
they would retain state.
do i have the wrong idea about using custom props like this? or should
i just stick to using the Session? OR, would it be best to use the
Session only in OnInit, and assign it to these custom props?
just trying to figure the best practice.
thanks!
matt