Having One Page Produce Multiple Views

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
 
A

Andrea D'Onofrio

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

Jj

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

Jianjun
 
G

George Ter-Saakov

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top