473,320 Members | 2,109 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 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 935

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
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.