Fill Tabstrip Control dynamically with multiple treeview controls

Fill Tabstrip Control dynamically with multiple treeview controls

Post by Brian Watk » Sat, 22 Nov 2003 05:09:12


I am trying to dyanmically add tabs to my tabstrip control and then build a
different treecontrol for each tab on my tab control.
Basically the Tabstrip control would have n number of tabs/pageviews and
each pageview would have its own treeview.
Any suggestions on how I could tweak the code below to make this whole thing
dynamic? Thanks in advance

Here is how I statically create the tabstrip with one tab and one treeview

<%@ Import Namespace="Microsoft.Web.UI.WebControls" %>
<%@ Register TagPrefix="mytab" Namespace="Microsoft.Web.UI.WebControls"
Assembly="Microsoft.Web.UI.WebControls %>
<%@ register TagPrefix="mytree" Namespace="Microsoft.Web.UI.WebControls"
Assembly ="Microsoft.Web.UI.WebControls" %>

<script runat="server" >

Sub Page_Load(sender as Object, e As EventArgs)

IF Not IsPostBack Then
Call FillTreeView()

End IF

End Sub

Sub FillTreeView()

'fill treeview code here

End Sub

<html>
<head>
<body>
<form id=f1 runat="server">

<mytab:TabStrip id="tsDocuments" runat="server" TargetID="mpHoriz">
<mytab:Tab Text="Tab1" />
<mytab:TabSeparator />
</mytab:TabStrip>
<mytab:MultiPage id="mpHoriz" runat="server">

<mytab:PageView>
<table>
<tr>
<td>
<MYTREE:TREEVIEW ID="tvwDirectory" RUNAT="server" CHILDTYPE="Directory"
<MYTREE:TREENODETYPE
TYPE="Directory"
CHILDTYPE="Files, Folders"
/>
<MYTREE:TREENODETYPE
TYPE="Folders"
CHILDTYPE="Files, Folders"
/>
<MYTREE:TREENODETYPE
TYPE="Files"
/>
</MYTREE:TREEVIEW>
</td>
</tr>
</table>
</mytab:PageView>

</mytab:MultiPage>

</FORM>
</body>
</html>
 
 
 

1. Dynamic controls into dynamic tabs in the tabstrip control

2. Dynamically adding branches to treeview.net javascript tree control

Pro bono publico...

After rendering the treeview.net tree, the code doesn't offer a means
to adding folders dynamically.
I've put in a little time investigating this, and here is the result:

function dynInsFolder(parent, folder)
{
// add to parent
insFld(parent, folder);

// build leftside indicator
var leftSide = parent.leftSideCoded;
if (parent.level > 0)
leftSide += (parent.isLastNode ? "0" : "1");
if (typeof leftSide == 'undefined')
leftSide = '';

// initialize
folder.initialize(parent.level + 1, true, leftSide)

// if parent has other siblings, rememer the last one
var lastSibling = (parent.nChildren == 1 ? null :
parent.children[parent.nChildren - 2]);

if (lastSibling != null)
lastSibling.isLastNode = 0;

// render the new folder if supposed to be visible
if (parent.isRendered && parent.isOpen)
{
// if no siblings, render after the parent, otherwise render after
the last sibling
var parentNavObj = (lastSibling == null ? parent.navObj :
lastSibling.navObj);
folder.renderOb(parentNavObj)
}

// if no siblings, need to update parent's node image and tree lines
if (parent.isRendered && parent.level > 0 && lastSibling == null)
refreshNodeImage(parent);

// if there is a sibling, need to update node image - change tree
lines to connect down as well
if (lastSibling != null && lastSibling.isRendered)
refreshNodeImage(lastSibling);
}

3. Filling a treeview control

4. Treeview control and locking up other controls?

5. TreeView Control on a Tab Control Loses its Position

6. Nest controls in a MS Treeview Web Control

7. dropdown control that contains treeview control

8. WinForm control will not display with TreeView control

9. How to add a user control inside a treeview control as a node

10. treeview control, MS Windows Common Control 5.0 (SP2)

11. Add Controls within Treeview Control asp.net v2.0

12. Treeview: inactive control to active control changes selected tree node

13. Controlling page height real estate used by TreeView Control

14. Pages (was Treeview control and locking up other controls?)