Having One Page Produce Multiple Views

  • Thread starter Thread starter Tim Rogers
  • Start date Start date
T

Tim Rogers

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
 
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.
 
you can implement each "view" as a "UserControl" and add these controls
dynamically based on the "step" parameter on to your aspx page.

Jianjun
 
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.
 
Back
Top