"Dynamic" include files?

Discussion in 'ASP General' started by Buddy Robbins, Jan 31, 2005.

  1. Hey folks,
    I am re-writing an ASP.Net site for a company.
    The client wants to be responsible for the static content and navigation of
    their site, and I'll be responsible for any dynamic content.

    I'm using Infragistics Ultra Web Navigator, which can load the menus from an
    XML file, so the navigation requirement is taken care of.

    I had created a generic aspx file that accepts the static content filename
    as a query string. The ASPX form has a header user web control (containg
    the menu control) and a footer user web control.
    Between the two, I'm using a select statement based on the query string to
    process the appropriate include file statements for the "guts" of the static
    content.

    This works fine right now, however, if the client wants to add new static
    pages, the default.aspx file has to be edited to add the case for the new
    web page.

    This seems like a clunky way to do it, and I can't figure out how go
    generate the include file line dynamically.

    Could anyone point me in a direction that will accomplish this?


    Thanks in advance,
    -Buddy Robbins
    Buddy Robbins, Jan 31, 2005
    #1
    1. Advertising

  2. Buddy Robbins

    Patrice Guest

    You could use Response.WriteFile, load content as an ASCX file etc...

    Patrice

    --

    "Buddy Robbins" <> a écrit dans le message de
    news:uAmX%...
    > Hey folks,
    > I am re-writing an ASP.Net site for a company.
    > The client wants to be responsible for the static content and navigation

    of
    > their site, and I'll be responsible for any dynamic content.
    >
    > I'm using Infragistics Ultra Web Navigator, which can load the menus from

    an
    > XML file, so the navigation requirement is taken care of.
    >
    > I had created a generic aspx file that accepts the static content filename
    > as a query string. The ASPX form has a header user web control (containg
    > the menu control) and a footer user web control.
    > Between the two, I'm using a select statement based on the query string to
    > process the appropriate include file statements for the "guts" of the

    static
    > content.
    >
    > This works fine right now, however, if the client wants to add new static
    > pages, the default.aspx file has to be edited to add the case for the new
    > web page.
    >
    > This seems like a clunky way to do it, and I can't figure out how go
    > generate the include file line dynamically.
    >
    > Could anyone point me in a direction that will accomplish this?
    >
    >
    > Thanks in advance,
    > -Buddy Robbins
    >
    >
    Patrice, Jan 31, 2005
    #2
    1. Advertising

  3. You will want to use the User Control way (ASCX). As you can take and use
    the Page.LoadControl(stringFromQueryString + ".ascx") and add this control
    to a placeholder.

    <asp:placeHolder id="place" runat="server" />

    In code...

    Sub Page_Load()

    Dim somevar as string
    If Request.QueryString("querystringvarname") Is Nothing Then
    somevar = "somecontrolThatShowsError"
    Else
    somevar = Request.Querystring("querystringvarname")
    End If

    place.Controls.Add(Page.LoadControl(somevar & ".ascx"))

    End Sub

    HTH.
    Ben Miller
    This post is provided "AS IS" and the code samples express no liabilities or
    warranties of any kind.

    "Buddy Robbins" <> wrote in message
    news:uAmX%...
    > Hey folks,
    > I am re-writing an ASP.Net site for a company.
    > The client wants to be responsible for the static content and navigation
    > of their site, and I'll be responsible for any dynamic content.
    >
    > I'm using Infragistics Ultra Web Navigator, which can load the menus from
    > an XML file, so the navigation requirement is taken care of.
    >
    > I had created a generic aspx file that accepts the static content filename
    > as a query string. The ASPX form has a header user web control (containg
    > the menu control) and a footer user web control.
    > Between the two, I'm using a select statement based on the query string to
    > process the appropriate include file statements for the "guts" of the
    > static content.
    >
    > This works fine right now, however, if the client wants to add new static
    > pages, the default.aspx file has to be edited to add the case for the new
    > web page.
    >
    > This seems like a clunky way to do it, and I can't figure out how go
    > generate the include file line dynamically.
    >
    > Could anyone point me in a direction that will accomplish this?
    >
    >
    > Thanks in advance,
    > -Buddy Robbins
    >
    Ben Miller [MSFT], Feb 3, 2005
    #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. Danny Anderson
    Replies:
    5
    Views:
    495
    Victor Bazarov
    Aug 15, 2003
  2. Rolf Magnus
    Replies:
    2
    Views:
    597
    Karl Heinz Buchegger
    Nov 28, 2003
  3. Andreas Bogenberger
    Replies:
    3
    Views:
    899
    Andreas Bogenberger
    Feb 22, 2008
  4. JP SIngh

    Dynamic Include files

    JP SIngh, Nov 15, 2004, in forum: ASP General
    Replies:
    4
    Views:
    108
    Aaron [SQL Server MVP]
    Nov 15, 2004
  5. Adam

    Dynamic include files

    Adam, May 27, 2004, in forum: Javascript
    Replies:
    13
    Views:
    442
    Thomas 'PointedEars' Lahn
    May 29, 2004
Loading...

Share This Page