Library tutorials & articles
Making skinned custom controls
Overview
This article will show you how you can easily make your custom controls skinned by deriving from a new control class that we will call SkinControl. SkinControl is an abstract class and derives from Control class, and introduces a new property and a few methods. These methods and the property is what will actually build the skin – one of the methods, Initialize, needs to be overridden by each control you want to be skinned. This must be done because it is in this method where you initialize all the HTML- and web controls that you want to control and that are part of the skin.
The skins will be user controls, in other words, .ASCX files. This makes it a very simple process to update the skins for your controls as you don't need to re-compile anything – all you need to do is to alter the HTML in the skin file and the update will be instantaneous (unless you of course choose to cache the skin files).
Note: the technique seen in this article is based upon the skinning technique as seen in ASP.NET Forums code.
Related articles
Related discussion
-
Profile Class does not work after Translation
by converter2009 (1 replies)
-
what is the SQL Server Provider
by hayperaktib (1 replies)
-
Very Urgent regarding deleting the images from a folder
by Nanosteps (6 replies)
-
Java Script, File uploading on ftp server using java script code
by h_c_a_andersen (2 replies)
-
sharepoint calendar web part with events from sql table
by converter2009 (2 replies)
Related podcasts
-
StackOverflow uses ASP.NET MVC - Jeff Atwood and his technical team
Scott chats with Jeff Atwood of CodingHorror.com and most recently, StackOverflow.com. Jeff and Joel Spolsky and their technical team have created a new class of application using ASP.NET MVC. What works, what doesn't, and how did it all go down?
Events coming up
-
Mar
15
DevWeek 2010
London, United Kingdom
DevWeek is Europe’s leading independent conference for software developers, database professionals and IT architects, and features expert speakers on a wide range of topics, including .NET 4.0, Silverlight 3, WCF 4, Visual Studio 2010, REST, Windows Workflow 4, Thread Synchronization, ASP.NET 4.0, SQL Server 2008 R2, LINQ, Unit Testing, CLR & C# 4.0, .NET Patterns, WPF 4, F#, Windows Azure, ADO.NET, Entity Framework, Debugging, T-SQL Tips & Tricks, and more.
You have successfully plundered the concepts contained in the asp.net forums without offering anything new, or really showing the reader why they would want to use them
Not to mention your wonderful coding practice of catch {}
What happens if the InitialiseSkin method makes calls to controls that don't exist on the skin? The skin is just not going to load, it won't show the user any helpful message. You're forgetting the skills of the average developer probably don't encompass debugging stack traces which don't get rethrown.
Nice one.
This thread is for discussions of Making skinned custom controls.