Disappearing asp:TreeView in a custom web control

Discussion in 'ASP .Net Web Controls' started by 6doughnuts@googlemail.com, Nov 3, 2006.

  1. Guest

    G'Day all,

    I've made a tabbed dialog custom web control that allows switching
    between tabs on the client-side with javascript. It inherits from
    CompositeControl and includes a collection of TabPanel controls that
    are used to define the tabs. TabPanel is another custom web control
    that inherits form Panel, and simply adds a TabText property. It all
    works sweet until I drop a TreeView control into one of the tabs.

    Any time a postback occurs, the TreeView control disappears. This
    happens if another control (eg. a Button) fires an event, or if the
    TreeView fires an event. If the TreeView fires an event, that event
    never reaches the event handler. The Button and Label controls I have
    in the tabs work fine. I've tried wiring up the TreeView
    SelectedNodeChanged event in the aspx, in the C# code, and not at all.
    Same effect every time. The TreeView IS rendering out it's SkipLink
    anchor tag after the postback, but nothing else.

    If anyone has any ideas that I could try, it would be most appreciated.
    Here are some code snippets:

    ASPX:
    <sw:tabbeddialog
    id="pnlTabs"
    runat="server">

    <sw:tabpanel id="Panel1" runat="server" cssclass="tabpane"
    tabtext="Tab 1">
    <asp:panel runat="server" id="pnlTreeViewContainer">
    <asp:TreeView
    id="navTreeView"
    runat="server"
    ExpandDepth="1" >
    </asp:TreeView>
    </asp:panel>
    </sw:tabpanel>
    <sw:tabpanel id="Panel2" runat="server" cssclass="tabpane"
    tabtext="Tab 2">
    <asp:label id="Label1" runat="server" text="This is tab 2" />
    <asp:button text="Click!" id="btnClick" runat="server" />
    </sw:tabpanel>
    </sw:tabbeddialog>

    Code-Behind:
    protected void Page_Load(object sender, EventArgs e) {
    if (!this.IsPostBack) {
    XmlDataSource src = new XmlDataSource();
    src.DataFile = @"C:\temp\basic.xml";
    this.navTreeView.DataSource = src;
    this.navTreeView.DataBind();
    }
    this.navTreeView.SelectedNodeChanged +=
    new EventHandler(Clicker);
    this.btnClick.Click += new EventHandler(Clicker);
    }

    protected void Clicker(object sender, EventArgs args)
    { Response.Write("Click!");}

    Thanks in advance,
    Matt
     
    , Nov 3, 2006
    #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. Matt Sokol
    Replies:
    2
    Views:
    409
    Theo Tillotson
    Aug 7, 2003
  2. GJH

    Custom Datagrid disappearing on Postback

    GJH, Dec 4, 2006, in forum: ASP .Net Building Controls
    Replies:
    5
    Views:
    150
  3. Ionutz
    Replies:
    2
    Views:
    548
    Ionutz
    Oct 23, 2005
  4. GJH

    Custom Datagrid disappearing on Postback

    GJH, Dec 4, 2006, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    108
  5. Peter Cook

    Web Service with disappearing Web Methods

    Peter Cook, Sep 12, 2005, in forum: ASP .Net Web Services
    Replies:
    0
    Views:
    111
    Peter Cook
    Sep 12, 2005
Loading...

Share This Page