CustomControls
ASP.NET custom Controls


Currently, This Solution has a single Custom Control "Thermometer". It demonstrates:
  1. Embedding and using a .css file used to render the contorl
  2. Resolving the image file references used in the CSS file.
The Basic steps that need to be followed are:
assembly: WebResource("ServerControl1.Thermometer.css", "text/css", PerformSubstitution=true)
assembly: WebResource("ServerControl1.thermometer_base.png", "image/png")
Note that PerformSubstitution = true is required to resolve the url used in the css file.
protected override void OnPreRender(EventArgs e)
{
// Add style sheet to parent page
string cssUrl = Page.ClientScript.GetWebResourceUrl(this.GetType(), "ServerControl1.Thermometer.css");
String ResourceURL = Page.ClientScript.GetWebResourceUrl(this.GetType(), "ServerControl1.thermometer_base.png");
.ThermoBase {
background-image: url('<%=WebResource("ServerControl1.thermometer_base.png")%>');
background-repeat: no-repeat;
}