and then maybe end with an "else" that just displays the default info for the whole firm. (if they don't chose a valid querystring value.)
So, HOW THE HECK WOULD YOU DO SOMETHING LIKE THIS IN ASP.NET? Is it even possible?
I'm not grabbing the content out of a database; it just lives on the page. If I have to create individual pages for each of the four people, well, then fine, but that seems not so efficient.
I'm using C#...Does the "check" for querystring have to happen in the codebehind? So, if you check for it there, how do you tell the aspx page what content to display based on the querystring?
Sure. Put a Panel control on the aspx page and put all those links inside it. Now in the page_load event you would use: If (QueryString("blah") = "blah") Panel1.Visible = False. There's a pretty good chance the code I show is wrong because I'm not a VB person.
But you get the idea, hopefully.
Member
14 Points
153 Posts
can you use Querystring values to choose static content to display?
Feb 15, 2012 03:19 PM|dezinnia|LINK
Just getting my feet wet in this...
In Classic ASP, if I wanted to display certain static content based on a querystring, it's easy...
Like, I might have a list of people on a firm's "people" page, and the links just point to the same page, but differentiated by querystring value...
And then I would display the content like this:
<% if request.querystring("person") = "bob" then%>
Bob is a great guy
<% elseif request.querystring("person") = "carol" then%>
Carol is a great gal....etc...
and then maybe end with an "else" that just displays the default info for the whole firm. (if they don't chose a valid querystring value.)
So, HOW THE HECK WOULD YOU DO SOMETHING LIKE THIS IN ASP.NET? Is it even possible?
I'm not grabbing the content out of a database; it just lives on the page. If I have to create individual pages for each of the four people, well, then fine, but that seems not so efficient.
I'm using C#...Does the "check" for querystring have to happen in the codebehind? So, if you check for it there, how do you tell the aspx page what content to display based on the querystring?
Thank you!
All-Star
101931 Points
20703 Posts
Re: can you use Querystring values to choose static content to display?
Feb 15, 2012 03:23 PM|MetalAsp.Net|LINK
Member
14 Points
153 Posts
Re: can you use Querystring values to choose static content to display?
Feb 15, 2012 03:24 PM|dezinnia|LINK
if you could give me a simple example of what would go on the codebehind page, and then on the aspx page, I would be forever in your debt! ;)
Member
700 Points
229 Posts
Re: can you use Querystring values to choose static content to display?
Feb 15, 2012 03:29 PM|OnoSendai|LINK
Did you tried using the same content on an aspx page? they would work in exactly the same fashion. =)
Request.QueryString also exists on ASP.NET, altho with slightly different/additional features.
Now, to obtain a similar behaviour on your ASP.NET application, i'd suggest this:
All-Star
101931 Points
20703 Posts
Re: can you use Querystring values to choose static content to display?
Feb 15, 2012 03:35 PM|MetalAsp.Net|LINK
Member
14 Points
153 Posts
Re: can you use Querystring values to choose static content to display?
Feb 15, 2012 03:51 PM|dezinnia|LINK
THANK YOU!!!
OK, I did this on the aspx page:
<asp:Panel ID="bobpanel" runat="server" Visible="false">
Blah Blah Content for Bob
</asp:Panel>
And then on the codebehind page I did this:
string p = Request.QueryString["p"];
if (p == "1")
bobpanel.Visible = true;
IT WORKED.
Thanks again!