Problem programmatically creating tabstrip webcontrol

Discussion in 'ASP .Net Web Controls' started by Hal, Oct 31, 2003.

  1. Hal

    Hal Guest

    I hope I'm getting the right group this time.

    I am trying to programmatically build a tabstrip (creating a template
    class for my site that contains a tabstrip in the header). I'm using
    the tabstrip from "Microsoft.web.ui.webcontrol" (iewebcontrols).

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

    '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...

    'set up tabitem
    tiHome.Text = "Home"

    'add tabitem to tabstrip
    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.

    Any ideas?
    -
    Hal
     
    Hal, Oct 31, 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 Fri, 31 Oct 2003 04:14:26 GMT, Hal
    <> wrote:

    >I hope I'm getting the right group this time.
    >
    >I am trying to programmatically build a tabstrip (creating a template
    >class for my site that contains a tabstrip in the header). I'm using
    >the tabstrip from "Microsoft.web.ui.webcontrol" (iewebcontrols).
    >
    >I have a form (as htmlform) to which I am adding controls and html
    >(via literalcontrol) and I try to add the tabstrip as follows:
    >
    >'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...
    >
    >'set up tabitem
    >tiHome.Text = "Home"
    >
    >'add tabitem to tabstrip
    >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.
    >
    >Any ideas?
    >-
    >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. Hal
    Replies:
    1
    Views:
    1,528
  2. =?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,047
    Teemu Keiski
    Jan 23, 2004
  3. 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:
    861
    Ken Cox [Microsoft MVP]
    May 4, 2004
  4. Patrick.O.Ige

    Tabstrip WebControl Question

    Patrick.O.Ige, Jul 11, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    847
    Aaron Corcoran
    Jul 12, 2005
  5. Replies:
    1
    Views:
    471
    Scott Allen
    Aug 26, 2005
Loading...

Share This Page