Thursday, August 30, 2012

Adding skins for custom controls in ASP.NET



Let's say we have a a custom control named MyTextBox which derives from TextBox  control and we need a skin for our MyTextBox control , we can do this by registering our custom control in the skin file

Ex :   <%@ Register Assembly = "WebControls.MyControls"  Namespace = "WebControls.MyControls" tagprefix = "cc1" %>

< cc1:MyTextBox runat="server" color = "black" backcolor="grey" />



Note: If your custom controls  are in the  App_Code folder then  we can omit Assembly attribute while registering.

That's it ,