CustomControls
ASP.NET custom Controls
This solution demonstrates the following:
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;
}
The Solution creates a pure HTML , CSS Thermometer Custom control.