Why the designer don't persist the property of my control? (Advanced)

U

Umut Tezduyar

I have build a sample control but the designer doesn't communicate with it
to parse the childen property. Please if you are an control developer, spend
your 10 minutes to solve my problem. I have read so many articles and books
to solve it but i couldn't.

Here is the code sample:

---------- Asp Page ----------------

<form id="Form1" method="post" runat="server">
<cc1:Umut runat="server" id="umut1ew">
<Tab name="main">
<Tabs>
<cc1:Tab name="sub1"/>
<cc1:Tab name="sub2"/>
</Tabs>
</Tab>
</cc1:Umut>
</form>

--------------------------------------


------------ Class Tab-----------------

[
System.ComponentModel.TypeConverter(typeof(System.ComponentModel.ExpandableObjectConverter)), System.Web.UI.ControlBuilder(typeof(System.Web.UI.ControlBuilder)) ] public class Tab { private ArrayList _tabs; private string _name; public Tab() { } [ System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.InnerProperty) ] public ArrayList Tabs { get { if (this._tabs == null) this._tabs = new System.Collections.ArrayList(); return this._tabs; } set { this._tabs = value; } } [ System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.Attribute) ] public string Name { get { return this._name; } set { this._name = value; } } }-----------------------------------------------------Class Umut------------------- [ System.ComponentModel.Designer(typeof(System.Web.UI.Design.ControlDesigner)), System.Web.UI.ParseChildren(true) ] public class Umut : System.Web.UI.Control { private Tab _tab; public Tab Tab { get { if (this._tab == null) { this._tab = new Tab(); this._tab.Name = "Default"; } return this._tab; } set { this._tab = value; } } protected override void Render(System.Web.UI.HtmlTextWriter writer) { this.RenderTab (writer, this.Tab); } private void RenderTab(System.Web.UI.HtmlTextWriter writer, Tab tab) { writer.Write (string.Format (">>Tab name={0}<br>", tab.Name)); foreach (Tab t in tab.Tabs) this.RenderTab (writer, t); } }-----------------------------------------------------------------
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top