Passing Values to BasePage properties via Compiler Directive
Posted
Monday, August 8, 2005 8:31 AM
by
C-Dog's .NET Tip of the Day
One of the neat new features is that you can pass in values of custom properties to a BasePage via the compiler directive. For example, if you had a base page like the one below.
public class LocalBasePage: System.Web.UI.Page
{
protected string locationCode;
public string LocationCode
{
get { return locationCode; }
set { locationCode = value; }
}
}
Then assuming you had some page that inherited from the page above, you could pass the value of the LocationCode via compiler directive
<%@ Page Language="C#" LocationCode="LAX" Inherits="LocalBasePage" %>
This is kind of a neat new feature in that it allows yet another way to pass values into a base page.
Read the complete post at http://www.dotnettipoftheday.com/blog.aspx?id=82