# Form Designer: How to change the stylesheet dynamically

**URL:** <https://discuss.workflowgen.com/t/form-designer-how-to-change-the-stylesheet-dynamically/257>\
**Category:** Form Designer\
**Created:** [December 4, 2013, 6:08am UTC](https://discuss.workflowgen.com/t/form-designer-how-to-change-the-stylesheet-dynamically/257 "2013-12-04T06:08:33Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![wfg-admin](https://yyz2.discourse-cdn.com/flex030/user_avatar/discuss.workflowgen.com/wfg-admin/32/714_2.png) [@wfg-admin](https://discuss.workflowgen.com/u/wfg-admin)\
**Post date:** [December 4, 2013, 6:08am UTC](https://discuss.workflowgen.com/t/form-designer-how-to-change-the-stylesheet-dynamically/257/1 "2013-12-04T06:08:33Z")

</div>

This feature is available since version 5.6.2.

If you want to change the web form stylesheet and other attributes (header image, footer text, etc.) at runtime you can add the following .NET code to your form.

This example replaces:

- The current "metal.css" template stylesheet
- The header title label
- The header image
- The footer title label
- The footer image

```auto
protected void Page_Load(object sender, EventArgs e)
{
base.Page_Load(sender, e);
String stylePath=HttpContext.Current.Request.PhysicalApplicationPath.Replace("WfApps\\WebForms\\","App_Data\\Templates\\Forms\\En\\Default\\css");
Page.Header.Controls.Remove(this.FindControl("StyleSheet"));
Page.Header.Controls.Add(
new LiteralControl(
System.IO.File.ReadAllText(stylePath + "\\" + "metal.css")
)
);
string imageUrl="http://mywebsite/mylogo.jpg";
HeaderImage.Style["background-image"] = "url('" + imageUrl+ "')";

HeaderTitleLabel.Text="My Title #";

FooterTitleLabel.Text="My footer";

imageUrl="http://mywebsite/myfooter.jpg";
FooterImage.Style["background-image"] = "url('" + imageUrl+ "')";

}

```

**Note:** You should define the width and the height of the images in the form configuration or in the .NET code. For example:

```auto
FooterImage.Style["width"] = "200px";
FooterImage.Style["height"] = "100px";

```

An absolute URL is recommended because the generated form archive (HTML) can be opened in an email notification.
