Fill Tabstrip Control dynamically with multiple TreeView controls

Discussion in 'ASP .Net Web Controls' started by Brian Watkins, Nov 21, 2003.

  1. I am trying to dynamically 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>
     
    Brian Watkins, Nov 21, 2003
    #1
    1. Advertising

  2. Brian Watkins

    Alvin Bruney Guest

    You can add controls to the treeview easily by doing a controls.add at the
    appropriate tab. Here is some code to guide you:

    Microsoft.Web.UI.WebControls.ToolbarButton ti = new
    Microsoft.Web.UI.WebControls.ToolbarButton();

    ti.ImageUrl = "icon_excel.gif";

    ti.ID = "Excel";

    ti.ButtonClick += new
    Microsoft.Web.UI.WebControls.ToolbarItemEventHandler(ti_ButtonClick);

    Tools.Items.AddAt(4,ti);

    ti = null;


    --


    -----------
    Got TidBits?
    Get it here: www.networkip.net/tidbits
    "Brian Watkins" <> wrote in message
    news:...
    > I am trying to dynamically 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>
    >
    >
     
    Alvin Bruney, Nov 21, 2003
    #2
    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. Mark Fox

    TabStrip controls

    Mark Fox, Aug 7, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    345
    Mark Fox
    Aug 8, 2003
  2. Natasha

    TabStrip or Tab Controls

    Natasha, Aug 21, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    414
    Mark Fitzpatrick
    Aug 21, 2003
  3. Luqman
    Replies:
    1
    Views:
    703
    Alvin Bruney [MVP]
    Apr 20, 2007
  4. Brian Watkins

    Fill Tabstrip Control dynamically with multiple treeview controls

    Brian Watkins, Nov 20, 2003, in forum: ASP .Net Building Controls
    Replies:
    0
    Views:
    164
    Brian Watkins
    Nov 20, 2003
  5. Burt

    Tabstrip control with multiple aspx pages?

    Burt, Sep 9, 2003, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    160
    Ken Cox [Microsoft MVP]
    Sep 10, 2003
Loading...

Share This Page