Dynamic tabstrip and multipage

Ask a Question related to ASP.NET Building Controls, Design and Development.

  1. #1

    Default Re: Dynamic tabstrip and multipage

    Hi

    You are right but I'm creating dynamic controls on each multi page
    and if I add the "If Not Page.IsPostBack Then" line I will not be able
    to find and access the dynamic controls I have created on the multi
    page

    Here is a new code example:

    Private Sub Demo1()
    Dim NewTab As Microsoft.Web.UI.WebControls.Tab
    Dim NewSeparator As Microsoft.Web.UI.WebControls.TabSeparator

    ' If Not Page.IsPostBack Then
    ' Create Tabs
    NewTab = New Microsoft.Web.UI.WebControls.Tab()
    NewTab.Text = "new tab1"
    tsKR.Items.Add(NewTab)

    NewSeparator = New
    Microsoft.Web.UI.WebControls.TabSeparator()
    tsKR.Items.Add(NewSeparator)

    NewTab = New Microsoft.Web.UI.WebControls.Tab()
    NewTab.Text = "new tab2"
    tsKR.Items.Add(NewTab)

    ' Create pages view
    Dim NewPageView1 As New PageView()
    NewPageView1.ID = "PageView1"
    mpKR.Controls.Add(NewPageView1)

    Dim NewPageView2 As New PageView()
    NewPageView2.ID = "PageView2"
    mpKR.Controls.Add(NewPageView2)
    ' End If

    Dim TextBox9 As New TextBox()
    TextBox9.ID = "9"
    TextBox9.Style("Top") = "60px"
    TextBox9.Style("Left") = "100px"
    FindControl("PageView1").Controls.Add(TextBox9)

    Dim dropdownlist1 As New DropDownList()
    dropdownlist1.ID = "6"
    dropdownlist1.Style("Top") = "60px"
    dropdownlist1.Style("Left") = "100px"
    dropdownlist1.Items.Add("1")
    dropdownlist1.Items.Add("2")
    dropdownlist1.AutoPostBack = True
    FindControl("PageView2").Controls.Add(dropdownlist 1)
    End Sub

    Elad.
    Elad Frid Guest

  2. Similar Questions and Discussions

    1. Reg- Dynamic tab strip and Multipage
      Tying to create Dynamic tab strip and Multipage using webcontols . Not able to wire the event selectedindexchanged event to tabstrip any sample...
    2. Create a web tabstrip control
      Hi. I need to do a tabstrip custom control for my web apps get the values of the title os the tabs from a xml file. I can render one table os...
    3. TabStrip controls
      Hello, Could anyone recommend a good ASP.NET TabStrip server control? The IE webcontrol requires IE 5.5 and higher but I have to support as...
    4. problem using Microsoft.Web.UI.Webcontrols Tabstrip
      Hello, i have a problem i want to inherit the tabstrip control and derive my own control to be used in my project for some reasons but when i do...
    5. IE Webcontrols - Tabstrip
      So has anyone worked with the IE webcontrols much? I've found that they've come in very handy for Internet Explorer clients ... ON A WINDOWS...
  3. #2

    Default Re: Dynamic tabstrip and multipage


    The tab strip keeps track of the tabs in ViewState (via the Items collection I guess); the PageView controls do not; so you either have to split your code in two (add the the tabs when !IsPostback and then add the PageViews each time); or you have to turn off the ViewState for the TabStrip (and if that can't be done then clear the tab strip each time -- you'll probably have to keep track of the active tab when doing things this way).

    The way I do this is kinda like this:

    protected override void CreateChildControls()
    {
    FormTabs = new TabStrip();
    if (!IsPostBack)
    {
    foreach (tab-want-to-create)
    {
    Tab t = new Tab();
    FormTabs.Items.Add(t);
    }
    }

    FormPages = new MultiPage();
    foreach (page--want-to-create)
    {
    FormPage.Controls.Add(new PageView());
    }
    Controls.Add(FormPages);
    FormTabs.TargetId = ID of FormPages;
    Controls.Add(FormTabs);
    }

    Scott
    "Elad Frid" <felad@walla.co.il> wrote in message news:3ccf753e.0405020741.73ec1f43@posting.google.c om...
    Hi

    You are right but I'm creating dynamic controls on each multi page
    and if I add the "If Not Page.IsPostBack Then" line I will not be able
    to find and access the dynamic controls I have created on the multi
    page

    Here is a new code example:

    Private Sub Demo1()
    Dim NewTab As Microsoft.Web.UI.WebControls.Tab
    Dim NewSeparator As Microsoft.Web.UI.WebControls.TabSeparator

    ' If Not Page.IsPostBack Then
    ' Create Tabs
    NewTab = New Microsoft.Web.UI.WebControls.Tab()
    NewTab.Text = "new tab1"
    tsKR.Items.Add(NewTab)

    NewSeparator = New
    Microsoft.Web.UI.WebControls.TabSeparator()
    tsKR.Items.Add(NewSeparator)

    NewTab = New Microsoft.Web.UI.WebControls.Tab()
    NewTab.Text = "new tab2"
    tsKR.Items.Add(NewTab)

    ' Create pages view
    Dim NewPageView1 As New PageView()
    NewPageView1.ID = "PageView1"
    mpKR.Controls.Add(NewPageView1)

    Dim NewPageView2 As New PageView()
    NewPageView2.ID = "PageView2"
    mpKR.Controls.Add(NewPageView2)
    ' End If

    Dim TextBox9 As New TextBox()
    TextBox9.ID = "9"
    TextBox9.Style("Top") = "60px"
    TextBox9.Style("Left") = "100px"
    FindControl("PageView1").Controls.Add(TextBox9)

    Dim dropdownlist1 As New DropDownList()
    dropdownlist1.ID = "6"
    dropdownlist1.Style("Top") = "60px"
    dropdownlist1.Style("Left") = "100px"
    dropdownlist1.Items.Add("1")
    dropdownlist1.Items.Add("2")
    dropdownlist1.AutoPostBack = True
    FindControl("PageView2").Controls.Add(dropdownlist 1)
    End Sub

    Elad.
    Scott G. Guest

  4. #3

    Default Re: Dynamic tabstrip and multipage


    Got it, thanks for your help.

    Elad.

    *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
    Don't just participate in USENET...get rewarded for it!
    Elad Frid Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139