|
using System;
using System.Web.UI.HtmlControls;
namespace DynamicStyling
{
/// <summary>
/// Summary description for BasePage.
/// </summary>
public class BasePage : System.Web.UI.Page
{
#region Members and Properties
private string _StyleClass;
public string StyleClass
{
get
{
return _StyleClass;
}
set
{
_StyleClass = value;
}
}
//More Members Here
#endregion
/// <summary>
/// This adds a class attribute to the Form element called Form1
/// in any inheriting ASP.Net page.
/// </summary>
private void styleForm()
{
HtmlForm Form1 = (HtmlForm)this.FindControl("Form1");
Form1.Attributes.Add("class", _StyleClass);
}
public BasePage()
{
}
protected override void OnPreRender(EventArgs e)
{
base.OnPreRender (e);
//give the Form element the appropriate style class
styleForm();
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
Over 5 years of experience as a Web Developer using ASP.NET.
Appreciates Good Design and continually seeks to improve his methods.
MCP in Developing Web Applications using ASP.NET, and in XML Web Services and Server Components.