Server Control Within Server Control

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm developing a server control that in turns contains another server control
(i.e. Label). I instantiate the label and expose the entire Label through a
property.


Imports System
Imports System.Web
Imports System.Web.UI

Public Class Class1
Inherits Control

Dim _label As New WebControls.Label
Public Property L() As WebControls.Label
Get
Return _label
End Get
Set(ByVal Value As WebControls.Label)
_label = Value
End Set
End Property

Dim _t As String
Public Property T() As String
Get
Return _t
End Get
Set(ByVal Value As String)
_t = Value
End Set
End Property
End Class

I then add this control to the toolbar and drag it to an aspx page. As you
can see in the picture I have my two properties "L" (the label with the +
sign for all the properties of the label) and the "T" (string)

If I set the "T" property I will get this in the html:
<cc2:Class1 id="Class11" runat="server" T="Hello World"></cc2:Class1>
Which is the reason why it gets persisted when I close and open the webform.
But if I expand the L property and set any of the properties of the label
nothing changes in the html and when I close and open the webform all the
properties from the Label get blanked out.

If I go to the HTML and manually add the property:

<cc2:Class1 id="Class11" runat="server" T="Hello World"
L-CssClass="Healy"></cc2:Class1> the changes will persist.

Basically, I need a way that when the properties of the label get changed in
the property pane they will get written to the html so they can get persisted
 
"As you can see in the picture I have my two properties"

There are no pictures, please ignore...

JoNaS
 
Back
Top