Disappearing asp:TreeView in a custom web control

6

6doughnuts

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
 

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,744
Messages
2,569,482
Members
44,900
Latest member
Nell636132

Latest Threads

Top