Disappearing asp:TreeView in a custom web control



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:


<sw:tabpanel id="Panel1" runat="server" cssclass="tabpane"
tabtext="Tab 1">
<asp:panel runat="server" id="pnlTreeViewContainer">
ExpandDepth="1" >
<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" />

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.SelectedNodeChanged +=
new EventHandler(Clicker);
this.btnClick.Click += new EventHandler(Clicker);

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

Thanks in advance,


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