By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,397 Members | 2,552 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,397 IT Pros & Developers. It's quick & easy.

Need help with skin file for Usercontrol

P: n/a

I'm very confused about how this works, all the tutorials out there
show me how to apply a skin to a webcontrol, but I want to know how
I can access the components of a control....for example:

I have a usercontrol, the ascx is defined like this:

<%@ Control Language="C#" AutoEventWireup="true"
CodeFile="Test.ascx.cs" Inherits="Spin.Test" %>

<asp:Panel ID="Panel1" runat="server" Height="243px" Width="350px">
<asp:Label ID="header1LBL" runat="server" Height="25px"
Width="100%">Header</asp:Label>
<asp:Label ID="infoLBL" runat="server" Height="25px"
Width="100%">Subheader</asp:Label>
<asp:Label ID="contentLBL" runat="server" Height="100%"
Width="100%"></asp:Label>
</asp:Panel>

Now, how can I skin this component in a skin file and tell it to, for
example:

*) Assign a width of 100% to the "Panel1"
*) Make the text for "header1LBL" bold,
*) make the text for "infoLBL" smaller
*) make the background color for "contentLBL" blue

I have registered the usercontrol in my skin file like this:

<%@ Register Src="../../Test.ascx" TagName="Test" TagPrefix="uc1" %>

but beyond that, I'm completely clueless!
Thanks in advance,

Philipp Lenz
Dec 4 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
The controls used within your usercontrol are not directly accessible by
the consuming page. If you want to be able to manipulate the properties
of contained controls (for skinning, etc), you need to make them
available through public properties on the usercontrol.

Add a Width property to your usercontrol which sets the width of the Panel.
Add a HeaderStyle property to your usercontrol which sets the style for
header1LBL.
Add a SubHeaderStyle property to your usercontrol which sets the style
for header1LBL.
Add a ContentStyle property to your usercontrol which sets the style for
header1LBL.

Joshua Flanagan
http://flimflan.com/blog
Philipp Lenz wrote:
I'm very confused about how this works, all the tutorials out there
show me how to apply a skin to a webcontrol, but I want to know how
I can access the components of a control....for example:

I have a usercontrol, the ascx is defined like this:

<%@ Control Language="C#" AutoEventWireup="true"
CodeFile="Test.ascx.cs" Inherits="Spin.Test" %>

<asp:Panel ID="Panel1" runat="server" Height="243px" Width="350px">
<asp:Label ID="header1LBL" runat="server" Height="25px"
Width="100%">Header</asp:Label>
<asp:Label ID="infoLBL" runat="server" Height="25px"
Width="100%">Subheader</asp:Label>
<asp:Label ID="contentLBL" runat="server" Height="100%"
Width="100%"></asp:Label>
</asp:Panel>

Now, how can I skin this component in a skin file and tell it to, for
example:

*) Assign a width of 100% to the "Panel1"
*) Make the text for "header1LBL" bold,
*) make the text for "infoLBL" smaller
*) make the background color for "contentLBL" blue

I have registered the usercontrol in my skin file like this:

<%@ Register Src="../../Test.ascx" TagName="Test" TagPrefix="uc1" %>

but beyond that, I'm completely clueless!
Thanks in advance,

Philipp Lenz

Dec 4 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.