Having One Page Produce Multiple Views

Discussion in 'ASP .Net' started by Tim Rogers, Nov 7, 2003.

  1. Tim Rogers

    Tim Rogers Guest

    I'm trying to figure out how to make one aspx file produce multiple views
    depending on the value of a query string, etc. I've done this in classic
    ASP before where you might key off a URL like
    www.mysite.com/myfile.aspx?step=3. So, in myfile.aspx I would be checking
    the value of 'step' and would write out the appropriate web controls. Maybe
    step=3 means we're on the third page of a wizard-type web page and I need to
    display certain controls, text etc.

    In ASP.NET it's not readily apparent to me how to do this. Since the visual
    content and the code-behind are separated I'm not sure how to make the
    content (in the aspx file) different (since it appears to be static)
    depending on something like a query string variable. Maybe I'm wrong, but I
    haven't seen any examples of aspx files that have code like "If step=2
    display these controls, but if step=3 display these controls". Could anyone
    show me a quick example how to do this, or point me somewhere that does?

    I'd need to see how this is done, but if this is not the 'best practice'
    approach for this requirement in ASP.NET I'd like to hear any additional
    suggestions as well.

    Thanks,

    Tim Rogers
    Tim Rogers, Nov 7, 2003
    #1
    1. Advertising

  2. Server.Execute could be an option (the called page can access to the
    original QueryString parameters and then it could modify its behaviour) for
    simple web apps.

    "Tim Rogers >" <tim<removethis> wrote in message
    news:68ee7$3fabb10a$44a50e67$...
    > I'm trying to figure out how to make one aspx file produce multiple views
    > depending on the value of a query string, etc. I've done this in classic
    > ASP before where you might key off a URL like
    > www.mysite.com/myfile.aspx?step=3. So, in myfile.aspx I would be checking
    > the value of 'step' and would write out the appropriate web controls.

    Maybe
    > step=3 means we're on the third page of a wizard-type web page and I need

    to
    > display certain controls, text etc.
    >
    > In ASP.NET it's not readily apparent to me how to do this. Since the

    visual
    > content and the code-behind are separated I'm not sure how to make the
    > content (in the aspx file) different (since it appears to be static)
    > depending on something like a query string variable. Maybe I'm wrong, but

    I
    > haven't seen any examples of aspx files that have code like "If step=2
    > display these controls, but if step=3 display these controls". Could

    anyone
    > show me a quick example how to do this, or point me somewhere that does?
    >
    > I'd need to see how this is done, but if this is not the 'best practice'
    > approach for this requirement in ASP.NET I'd like to hear any additional
    > suggestions as well.
    >
    > Thanks,
    >
    > Tim Rogers
    >
    >
    Andrea D'Onofrio, Nov 7, 2003
    #2
    1. Advertising

  3. Tim Rogers

    Jj Guest

    you can implement each "view" as a "UserControl" and add these controls
    dynamically based on the "step" parameter on to your aspx page.

    Jianjun


    "Tim Rogers >" <tim<removethis> wrote in message
    news:68ee7$3fabb10a$44a50e67$...
    > I'm trying to figure out how to make one aspx file produce multiple views
    > depending on the value of a query string, etc. I've done this in classic
    > ASP before where you might key off a URL like
    > www.mysite.com/myfile.aspx?step=3. So, in myfile.aspx I would be checking
    > the value of 'step' and would write out the appropriate web controls.

    Maybe
    > step=3 means we're on the third page of a wizard-type web page and I need

    to
    > display certain controls, text etc.
    >
    > In ASP.NET it's not readily apparent to me how to do this. Since the

    visual
    > content and the code-behind are separated I'm not sure how to make the
    > content (in the aspx file) different (since it appears to be static)
    > depending on something like a query string variable. Maybe I'm wrong, but

    I
    > haven't seen any examples of aspx files that have code like "If step=2
    > display these controls, but if step=3 display these controls". Could

    anyone
    > show me a quick example how to do this, or point me somewhere that does?
    >
    > I'd need to see how this is done, but if this is not the 'best practice'
    > approach for this requirement in ASP.NET I'd like to hear any additional
    > suggestions as well.
    >
    > Thanks,
    >
    > Tim Rogers
    >
    >
    Jj, Nov 9, 2003
    #3
  4. I can recommend to download DotNetNuke (from dotnetnuke.com)
    The whole site is done with only one default.aspx.

    But pretty much you got the answer.

    George.

    "Jj" <> wrote in message
    news:...
    > you can implement each "view" as a "UserControl" and add these controls
    > dynamically based on the "step" parameter on to your aspx page.
    >
    > Jianjun
    >
    >
    > "Tim Rogers >" <tim<removethis> wrote in message
    > news:68ee7$3fabb10a$44a50e67$...
    > > I'm trying to figure out how to make one aspx file produce multiple

    views
    > > depending on the value of a query string, etc. I've done this in

    classic
    > > ASP before where you might key off a URL like
    > > www.mysite.com/myfile.aspx?step=3. So, in myfile.aspx I would be

    checking
    > > the value of 'step' and would write out the appropriate web controls.

    > Maybe
    > > step=3 means we're on the third page of a wizard-type web page and I

    need
    > to
    > > display certain controls, text etc.
    > >
    > > In ASP.NET it's not readily apparent to me how to do this. Since the

    > visual
    > > content and the code-behind are separated I'm not sure how to make the
    > > content (in the aspx file) different (since it appears to be static)
    > > depending on something like a query string variable. Maybe I'm wrong,

    but
    > I
    > > haven't seen any examples of aspx files that have code like "If step=2
    > > display these controls, but if step=3 display these controls". Could

    > anyone
    > > show me a quick example how to do this, or point me somewhere that does?
    > >
    > > I'd need to see how this is done, but if this is not the 'best practice'
    > > approach for this requirement in ASP.NET I'd like to hear any additional
    > > suggestions as well.
    > >
    > > Thanks,
    > >
    > > Tim Rogers
    > >
    > >

    >
    >
    George Ter-Saakov, Nov 10, 2003
    #4
    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. Ruben
    Replies:
    3
    Views:
    566
    Dave Mandelin
    Mar 27, 2006
  2. SV
    Replies:
    1
    Views:
    609
    Mukul Gandhi
    Aug 16, 2005
  3. Bill Sexton
    Replies:
    1
    Views:
    404
    Bill Sexton
    Jan 26, 2007
  4. Replies:
    5
    Views:
    449
    Luc The Perverse
    Oct 27, 2006
  5. Ralph Shnelvar

    MVC .... Many views and one controller

    Ralph Shnelvar, Jan 18, 2010, in forum: Ruby
    Replies:
    6
    Views:
    149
    Walton Hoops
    Jan 18, 2010
Loading...

Share This Page