G
Guest
I am trying to create a BasePage for use in a large asp.net application, that
will centrally provide certain extra properties and logic to the application.
(The web project makes use Master Pages as well.)
I want to make a property named TitleResourceKey, for example, that contains
the resource key used to translate the page title and, using reflection and
the CustomLocalisationKey attribute that points to the property this key
translates, automatically translate the Title value.
My problem (simple as it seems) is that I don't seem to be able to add
properties to the BasePage class that show up in the pages that inherit from
it. Should I be adding this property to the BaseMasterPage class (extends
MasterPage) or the BasePage class (extends Page)? (Either way it doesn't
show up for me in the property explorer when I am editing the page in
VS2005.) Any ideas why this isn't showing up? I'm sure it's something
completely stupid on my part, since it seems to bloody obvious.
/// <summary>
/// Adds common functionality to all Pages.
/// </summary>
public class BasePage : Page
{
#region Private Fields
private string m_titleResourceKey;
#endregion
#region Public Properties
[CustomLocalisationKey("Title")]
[Bindable(true)]
[Description("The resource key used when translating the page
Title.")]
[Category("Appearance")]
public string TitleResourceKey
{
get
{
return m_titleResourceKey;
}
set
{
m_titleResourceKey = value;
}
}
#endregion
}
I'm, of course, inheriting from this class on each page: public partial
class SupportHome : BasePage
Any ideas?
will centrally provide certain extra properties and logic to the application.
(The web project makes use Master Pages as well.)
I want to make a property named TitleResourceKey, for example, that contains
the resource key used to translate the page title and, using reflection and
the CustomLocalisationKey attribute that points to the property this key
translates, automatically translate the Title value.
My problem (simple as it seems) is that I don't seem to be able to add
properties to the BasePage class that show up in the pages that inherit from
it. Should I be adding this property to the BaseMasterPage class (extends
MasterPage) or the BasePage class (extends Page)? (Either way it doesn't
show up for me in the property explorer when I am editing the page in
VS2005.) Any ideas why this isn't showing up? I'm sure it's something
completely stupid on my part, since it seems to bloody obvious.
/// <summary>
/// Adds common functionality to all Pages.
/// </summary>
public class BasePage : Page
{
#region Private Fields
private string m_titleResourceKey;
#endregion
#region Public Properties
[CustomLocalisationKey("Title")]
[Bindable(true)]
[Description("The resource key used when translating the page
Title.")]
[Category("Appearance")]
public string TitleResourceKey
{
get
{
return m_titleResourceKey;
}
set
{
m_titleResourceKey = value;
}
}
#endregion
}
I'm, of course, inheriting from this class on each page: public partial
class SupportHome : BasePage
Any ideas?