Library tutorials & articles
Making skinned custom controls
- Overview
- The base class - SkinControl
- A simple sample control
- Using the sample control
Using the sample control
In order to use the sample control on a page all you need to do is add a @Register directive to the assembly: <%@ Register TagPrefix="MySite" Namespace="MySite.Controls" Assembly="MySite" %>
And to add the actual control to the page: <MySite:SampleControl SkinVirtualPath="SampleSkin.ascx" runat="server"/>
The property SkinVirtualPath is optional, but I thought I'd just show you how you can easily override the default skin for a control.
And of course you need to create a skin - here is an example: <%@ Control Language="C#" %>
<asp:label id="Label1" cssclass="header" runat="server"/><br/>
<asp:repeater id="Repeater1" runat="server">
<itemtemplate><%# Container.DataItem %></itemtemplate>
<separatortemplate>, </separatortemplate>
</asp:repeater>
Well that's it basically – I hope you've enjoyed reading this.
Related articles
Related discussion
-
Gizmox Announces release of Visual WebGui SDK version 6.2.2
by Visual WebGui (0 replies)
-
Error 4 Make sure that the class defined in this code file matches the 'inherits' attribute, and that it extends the correct base class (e.g. Page or UserControl).
by lbargers (3 replies)
-
How to receive data in web server sending from GPRS modem
by AshokSingh (1 replies)
-
Working with frames in c# .net
by pulak2008 (0 replies)
-
Time Out Problem
by lorrainepetty (1 replies)
Related podcasts
-
CodeCast Episode 4: State of .NET, IE8, ASP.NET MVC, and O'Reilly Media
CodeCast Episode 4: State of .NET, IE8, ASP.NET MVC, and O'Reilly MediaHosts Ken Levy and Markus Egger discuss the new State of .NET events, IE8, ASP.NET MVC, followed by an interview from PDC with two editors from O'Reilly Media. More on ASP.NET MVC can be found at http://asp.net/mvc. Interview...
Related jobs
-
Microsoft .Net Architect
in AMSTERDAM (€50K-€90K per annum) -
Microsoft Dynamics CRM Technical Consultant
in Netherlands (€50K-€90K per annum) -
.net developer
in Rijswijk (€2K-€4K per annum)
Events coming up
-
Dec
3
An afternoon of SQL Server Data Services and ASP.NET Dynamic Data
Bradford, United Kingdom
This event is in association with Black Marble. In the morning Black Marble will be presenting on Microsoft "Oslo": The Future of Enterprise Applications. To find out more about this please follow the link on the right.
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.