472,780 Members | 1,964 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,780 software developers and data experts.

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:
===Default.aspx
[...]
<form id="form1" runat="server">
<div>
<tp:Test runat="server" ID="tl">
<Header Text="Hello"></Header>
</tp:Test>
</div>
</form>
[...]

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

===Test.vb
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
Get
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
Get
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
Get
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
System.Web.UI.HtmlTextWriter)
'check if the header is to be displayed
If _bDisplayHeader Then
'insert the header to the child controls
Me.Controls.Add(Header)
End If

MyBase.RenderContents(writer)
End Sub
End Class
End Namespace
May 7 '07 #1
0 915

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: HarveyB | last post by:
I would like to generate non-modal popup windows from ASP.Net code-behind. I have tried using Client Side scripting like "function Test(){ window.open('test.htm',_blank,...
2
by: Hazzard | last post by:
I just realized that the code I inherited is using all asp.net server controls (ie. webform controls) and when I try to update textboxes on the client side, I lose the new value of the textbox when...
2
by: Brian | last post by:
NOTE ALSO POSTED IN microsoft.public.dotnet.framework.aspnet.buildingcontrols I have solved most of my Server Control Collection property issues. I wrote an HTML page that describes all of the...
4
by: clintonG | last post by:
Technically speaking, this issue is not about modifying the HTML generated by server controls but preceding the HTML generated by server controls with an HTML control generated on the basis of the...
9
by: AFN | last post by:
I was just dropped into someone else's code (isn't that always so fun?). I can't figure out why a custom validation control's server event function is executing. There is nothing (that I see)...
20
by: Guadala Harry | last post by:
In an ASCX, I have a Literal control into which I inject a at runtime. litInjectedContent.Text = dataClass.GetHTMLSnippetFromDB(someID); This works great as long as the contains just...
7
by: Shimon Sim | last post by:
I have a custom composite control I have following property
5
by: serge calderara | last post by:
Dear all, I am new in asp.net and prepare myself for exam I still have dificulties to understand the difference between server control and HTML control. Okey things whcih are clear are the fact...
2
by: Mike | last post by:
Hi, I am strugling with a simple problem which I can't seem to resolve. I have an asp.net page which contains a server-control (flytreeview, which is a kind of a tree to be exact). The tree is...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: lllomh | last post by:
How does React native implement an English player?
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.