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

Discussion in 'ASP .Net Web Controls' started by Umut Tezduyar, Dec 2, 2005.

  1. I have build a sample control but the designer doesn't communicate it to
    parse the childen. Please if you are an control developer, spend your 10
    minutes to solve my problem.

    The main problem is, whenever i made a change in the sub object (Tab) it
    doesn't persist the changes to the asp.net page.

    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>

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




    [
    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; } } } [ 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); } }
     
    Umut Tezduyar, Dec 2, 2005
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Umut Tezduyar
    Replies:
    0
    Views:
    448
    Umut Tezduyar
    Nov 29, 2005
  2. Umut Tezduyar
    Replies:
    0
    Views:
    434
    Umut Tezduyar
    Dec 2, 2005
  3. Mr. SweatyFinger
    Replies:
    2
    Views:
    2,128
    Smokey Grindel
    Dec 2, 2006
  4. Vipeo

    Control Designer change property but does not persist

    Vipeo, Jan 12, 2006, in forum: ASP .Net Building Controls
    Replies:
    0
    Views:
    191
    Vipeo
    Jan 12, 2006
  5. Umut Tezduyar
    Replies:
    0
    Views:
    151
    Umut Tezduyar
    Nov 29, 2005
Loading...

Share This Page