asp. net Simple Realization of Page Skin Change Method

  • 2021-07-10 19:20:55
  • OfStack

In this paper, an example is given to describe the simple method of page skinning by asp. net. Share it for your reference, as follows:

Here to achieve the effect of page skin change, you can add the corresponding style to html form


private string _StyleClass;
public string StyleClass
{
  get { return _StyleClass; }
  set { _StyleClass = value; }
}
private void StyleForm()
{
  HtmlForm Form1 = this.FindControl("form1") as HtmlForm;
  Form1.Attributes.Add("class", _StyleClass);
}
protected override void OnPreRender(EventArgs e)
{
  // Control rendering calls methods 
  StyleForm();
  base.OnPreRender(e);
}

I hope this paper is helpful to everyone's asp. net programming.


Related articles: