adding tabitem to Tabstrip (ms ie webcontrol question)

Discussion in 'ASP .Net' started by Hal, Oct 30, 2003.

  1. Hal

    Hal Guest

    I am trying to programmatically build a tabstrip (creating a template
    class for my site that contains a tabstrip in the header).

    I have a form (as htmlform) to which I am adding controls and html
    (via literalcontrol) and I try to add the tabstrip the same way.

    'declare and initialize as appropriate:
    Dim tsTopNav As Microsoft.Web.UI.WebControls.TabStrip = New
    Microsoft.Web.UI.WebControls.TabStrip

    Dim tiHome As Microsoft.Web.UI.WebControls.TabItem

    'set tabstrip properties
    tsTopNav.ID = "tsTopNav"
    tsTopNav.AutoPostBack = True
    tsTopNav.SepDefaultImageUrl = "/gfx/spacer.gif"
    tsTopNav.TabDefaultStyle.Add("background-color:", "#e6e6e6")
    tsTopNav.TabDefaultStyle.Add("font-family", "verdana")
    etc...

    form.Controls.Add(New LiteralControl)
    tiHome.Text = "Home"
    tsTopNav.Items.Add(tiHome)

    and I get
    "Object Reference not set to and instance of an object" in the line
    where tiHome.text = "Home" happens.

    Somehow tiHome is not properly being set up.

    Help!
    -
    Hal
    Hal, Oct 30, 2003
    #1
    1. Advertising

  2. Hal

    Hal Guest

    got it... the rather obvious (thought I had tried it and then finally
    went back and tried it again out of frustration)

    Dim tHome As Microsoft.Web.UI.WebControls.Tab = New
    Microsoft.Web.UI.WebControls.Tab

    tstopnav.items.add(tHome)

    On Thu, 30 Oct 2003 20:44:13 GMT, Hal
    <> wrote:

    >I am trying to programmatically build a tabstrip (creating a template
    >class for my site that contains a tabstrip in the header).
    >
    >I have a form (as htmlform) to which I am adding controls and html
    >(via literalcontrol) and I try to add the tabstrip the same way.
    >
    >'declare and initialize as appropriate:
    >Dim tsTopNav As Microsoft.Web.UI.WebControls.TabStrip = New
    >Microsoft.Web.UI.WebControls.TabStrip
    >
    >Dim tiHome As Microsoft.Web.UI.WebControls.TabItem
    >
    >'set tabstrip properties
    > tsTopNav.ID = "tsTopNav"
    > tsTopNav.AutoPostBack = True
    > tsTopNav.SepDefaultImageUrl = "/gfx/spacer.gif"
    > tsTopNav.TabDefaultStyle.Add("background-color:", "#e6e6e6")
    > tsTopNav.TabDefaultStyle.Add("font-family", "verdana")
    >etc...
    >
    >form.Controls.Add(New LiteralControl)
    >tiHome.Text = "Home"
    >tsTopNav.Items.Add(tiHome)
    >
    >and I get
    >"Object Reference not set to and instance of an object" in the line
    >where tiHome.text = "Home" happens.
    >
    >Somehow tiHome is not properly being set up.
    >
    >Help!
    >-
    >Hal
    Hal, Oct 31, 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. =?Utf-8?B?TWlrZQ==?=

    How to hide Tabstrip Webcontrol tab

    =?Utf-8?B?TWlrZQ==?=, Jan 23, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    1,034
    Teemu Keiski
    Jan 23, 2004
  2. Linda wu via .NET 247

    tabstrip webcontrol can not work in framework 1.1

    Linda wu via .NET 247, May 3, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    848
    Ken Cox [Microsoft MVP]
    May 4, 2004
  3. Patrick.O.Ige

    Tabstrip WebControl Question

    Patrick.O.Ige, Jul 11, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    832
    Aaron Corcoran
    Jul 12, 2005
  4. Replies:
    1
    Views:
    456
    Scott Allen
    Aug 26, 2005
  5. Steven

    Adding a WebControl to a WebControl

    Steven, Oct 13, 2008, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    107
    Steven
    Oct 13, 2008
Loading...

Share This Page