469,963 Members | 2,196 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,963 developers. It's quick & easy.

server control and themeing

Hello newsgroup,

the following problem turns me mad. It would be great if anyone could have a
look at it and maybe give me some hint.

I have developed a server control, which should be adjustable via themeing
and style sheets.
The server control itself inherits from WebControl and has for example these
three properties:
DisplayHeader() As Boolean
Title() As String
Header() As Label
(complete code see at the end of this post.)

During the rendering process the Label is added to the child controls,
depending on the DisplayHeader flag.

After adding such an object to a .aspx-site, all properties and design
values can be set and are interpreted correctly.
The problem is in the themeing. If I set up a theme for the .aspx-site and
append a style template to the proper .skin file not all properties are
being transferred to the object on the site.
The DisplayHeader flag is transferred correctly but all properties of the
label just seem to be ignored.
Maybe I am just missing an adequate attribute?

Does anyone have an idea?

Nico Ploner

Here is the code:
<form id="form1" runat="server">
<tp:Test runat="server" ID="tl">
<Header Text="Hello"></Header>

<tp:Test runat="server" DisplayHeader="true">
<Header backcolor="aquamarine"></Header>

Imports System
Imports System.ComponentModel
Imports System.Security.Permissions
Imports System.Web
Imports System.Web.UI
Imports System.Web.UI.WebControls

Namespace nsTest
< _
AspNetHostingPermission(SecurityAction.Demand, _
Level:=AspNetHostingPermissionLevel.Minimal), _
AspNetHostingPermission(SecurityAction.Inheritance Demand, _
Level:=AspNetHostingPermissionLevel.Minimal), _
DefaultProperty("Content"), _
ToolboxData( _
"<{0}:Test runat=""server""></{0}:Test>") _
Public Class Test
Inherits WebControls.WebControl

Private _bDisplayHeader As Boolean
Private _Header As Label

' returns if the title is to be displayed or sets it
Public Property DisplayHeader() As Boolean
Return _bDisplayHeader
End Get
Set(ByVal value As Boolean)
_bDisplayHeader = value
End Set
End Property

' returns the text of the title or sets it
Public Property Title() As String
Return Header.Text
End Get
Set(ByVal value As String)
Header.Text = value
End Set
End Property

' returns the appearance of the title
< _
Bindable(True), _
Category("Appearance"), _
DefaultValue(""), _
Description("The appearance of the header."), _
DesignerSerializationVisibility( _
DesignerSerializationVisibility.Content), _
PersistenceMode(PersistenceMode.InnerProperty) _
Public Property Header() As Label
If _Header Is Nothing Then _Header = New Label
Return _Header
End Get
Set(ByVal value As Label)
_Header = value
End Set
End Property
' object rendering
Protected Overrides Sub RenderContents(ByVal writer As
'check if the header is to be displayed
If _bDisplayHeader Then
'insert the header to the child controls
End If

End Sub
End Class
End Namespace
May 7 '07 #1
0 859

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

12 posts views Thread by HarveyB | last post: by
4 posts views Thread by clintonG | last post: by
5 posts views Thread by serge calderara | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.