Passing variable to an include via URL query string - a problemo

Discussion in 'ASP General' started by John Aspinall, Nov 8, 2004.

  1. Hi,

    Ive got a navigation bar for my web pages in an include (top_nav.asp).

    On my homepage (index.asp) and all the other site pages I have a
    reference to this include which includes my navigation bar in each
    page.

    <!--#include virtual="/includes/nav/top_nav.asp"-->

    My problem is, is that I need to pass a URL querystring variable to
    the top_nav.asp page. Im using this variable in Case statement to
    highlight a table cell a different colour to indicate which bit of the
    site they are in

    I can do this fine with this <a
    href="/content/table.asp?tab=table">Table</a>, but however this will
    obviously only load the Nav Bar include page, and not the whole page.
    When I point it the the index page <a
    href="/content/index.asp?tab=table">Index</a>, the nav bar page does
    not load correctly, its as if the include isnt seeing the querystring
    variable.

    Help!!!
    John Aspinall, Nov 8, 2004
    #1
    1. Advertising

  2. John Aspinall

    Turkbear Guest

    On 8 Nov 2004 07:55:29 -0800, (John Aspinall) wrote:

    >Hi,
    >
    >Ive got a navigation bar for my web pages in an include (top_nav.asp).
    >
    >On my homepage (index.asp) and all the other site pages I have a
    >reference to this include which includes my navigation bar in each
    >page.
    >
    > <!--#include virtual="/includes/nav/top_nav.asp"-->
    >
    >My problem is, is that I need to pass a URL querystring variable to
    >the top_nav.asp page. Im using this variable in Case statement to
    >highlight a table cell a different colour to indicate which bit of the
    >site they are in
    >
    >I can do this fine with this <a
    >href="/content/table.asp?tab=table">Table</a>, but however this will
    >obviously only load the Nav Bar include page, and not the whole page.
    >When I point it the the index page <a
    >href="/content/index.asp?tab=table">Index</a>, the nav bar page does
    >not load correctly, its as if the include isnt seeing the querystring
    >variable.
    >
    >Help!!!

    IIRC,
    All Includes are loaded BEFORE any code is interpreted, so your querystring variable is probably not seen by the
    include file at the time it loads.
    Turkbear, Nov 8, 2004
    #2
    1. Advertising

  3. I suspected this was the case. Is there a way around it?

    Turkbear <> wrote in message news:<>...
    > On 8 Nov 2004 07:55:29 -0800, (John Aspinall) wrote:
    >
    > >Hi,
    > >
    > >Ive got a navigation bar for my web pages in an include (top_nav.asp).
    > >
    > >On my homepage (index.asp) and all the other site pages I have a
    > >reference to this include which includes my navigation bar in each
    > >page.
    > >
    > > <!--#include virtual="/includes/nav/top_nav.asp"-->
    > >
    > >My problem is, is that I need to pass a URL querystring variable to
    > >the top_nav.asp page. Im using this variable in Case statement to
    > >highlight a table cell a different colour to indicate which bit of the
    > >site they are in
    > >
    > >I can do this fine with this <a
    > >href="/content/table.asp?tab=table">Table</a>, but however this will
    > >obviously only load the Nav Bar include page, and not the whole page.
    > >When I point it the the index page <a
    > >href="/content/index.asp?tab=table">Index</a>, the nav bar page does
    > >not load correctly, its as if the include isnt seeing the querystring
    > >variable.
    > >
    > >Help!!!

    > IIRC,
    > All Includes are loaded BEFORE any code is interpreted, so your querystring variable is probably not seen by the
    > include file at the time it loads.
    John Aspinall, Nov 9, 2004
    #3
    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. Paul Fi

    repeater control problemo!!!

    Paul Fi, Oct 18, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    288
    Paul Fi
    Oct 18, 2004
  2. Andreas Bogenberger
    Replies:
    3
    Views:
    903
    Andreas Bogenberger
    Feb 22, 2008
  3. Chris Larsen

    Mime::Parser::Filer problemo

    Chris Larsen, Sep 10, 2003, in forum: Perl Misc
    Replies:
    0
    Views:
    103
    Chris Larsen
    Sep 10, 2003
  4. Fred Lazy

    Passing variable via include?

    Fred Lazy, Jun 24, 2006, in forum: Javascript
    Replies:
    1
    Views:
    87
    Aaa aaa
    Jun 25, 2006
  5. nick
    Replies:
    1
    Views:
    453
    David Mark
    Feb 13, 2011
Loading...

Share This Page