J
John Saunders
Vincent V said:Hey im Overiding OnInit in my Custom Page class
What i want to be able to do is pass in Some Values
Ie PageID PageCategory, PageSubCategory
How can i pass in some Vairables So my Custom Page class can see these
I'm not sure what you mean here. If you want to set some values inside of
your custom page class, you can add public properties to the custom page
class. You can then create a separate control which has mirror copies of
those properties, and which simply sets them in the custom page class:
<wc:MyControl PageID="p1" PageCategory="Company"
PageSubCategory="Investment" />
MyControl would save the property values in class members until OnLoad is
called, then:
protected override void OnLoad(EventArgs e)
{
MyPage p = this.Page as MyPage;
if (p == null)
return;
p.PageID = m_PageID;
p.PageCategory = m_PageCategory;
p.PageSubCategory = m_PageSubCategory;
base.OnLoad(e);
}
....
The problem seems that Im using Overload that cuases only One of the OnInits
To Fire
When you override a method, you should almost always call the base class
method. When you call it depends on the nature of the method, but in this
case, call base.OnInit(e) at the end of your OnInit override.