Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Here is a very simple solution.</p> <pre><code>Partial Class UserControlStrings_TabMenu Inherits System.Web.UI.UserControl Private _Tabs As New MyTabsClass(Me) &lt;PersistenceMode(PersistenceMode.InnerProperty)&gt; Public ReadOnly Property Tabs As MyTabsClass Get Return _Tabs End Get End Property End Class Public Class MyTabsClass Inherits ControlCollection Sub New(ByVal owner As Control) MyBase.New(owner) End Sub Public Overrides Sub Add(ByVal child As System.Web.UI.Control) MyBase.Add(New MyTab(child)) End Sub End Class Public Class MyTab Inherits HtmlGenericControl Sub New(ByVal GenericControl As HtmlGenericControl) MyBase.New() Me.Label = GenericControl.Attributes("Label") Me.PanelId = GenericControl.Attributes("Panelid") End Sub Public Property Label As String = String.Empty Public Property PanelId As String = String.Empty Public Overrides Function ToString() As String Return Me.Label &amp; "-" &amp; Me.PanelId End Function End Class </code></pre> <p>(C# Version)</p> <pre><code>using System; using System.Collections; using System.Collections.Generic; using System.Data; using System.Diagnostics; partial class UserControlStrings_MyControl : System.Web.UI.UserControl { private MyTabsClass _Tabs = new MyTabsClass(this); [System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.InnerProperty)] public MyTabsClass Tabs { get { return _Tabs; } } } public class MyTabsClass : System.Web.UI.ControlCollection { public MyTabsClass(System.Web.UI.Control owner) : base(owner) { } public override void Add(System.Web.UI.Control child) { base.Add(new MyTab(child)); } } public class MyTab : System.Web.UI.HtmlControls.HtmlGenericControl { public MyTab(System.Web.UI.HtmlControls.HtmlGenericControl GenericControl) : base() { this.Label = GenericControl.Attributes("Label"); this.PanelId = GenericControl.Attributes("Panelid"); } private string _Label = System.String.Empty; public string Label { get { return _Label; } set { _Label = value; } } private string _PanelId = System.String.Empty; public string PanelId { get { return _PanelId; } set { _PanelId = value; } } public override string ToString() { return this.Label + "-" + this.PanelId; } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload