Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 275
  • Last Modified:

asp.net page - if page.previouspate...

Hi,

I am looking at making images/links visible and invisible when a user is redirected from a page but do not know really where to start on this one.

I have been looking round and found

if page.previouspage ! = (page.aspx) then
result here
end if

but this doesnt work...

Any suggestions?

Thanks

0
SimonPrice33
Asked:
SimonPrice33
  • 4
  • 2
1 Solution
 
Nathan BoveSoftware EngineerCommented:
There are several ways to go about doing this.  Probably the easiest way would be to use query string parameters.

Code for page doing the redirect:
Response.Redirect("NewPage.aspx?showImage1=true&showImage2=false")

Code for page selectively displaying images/links:
protected void Page_Load(object sender, EventArgs e) {
  image1.Visible = bool.Parse(Request.QueryString["showImage1"]);
  image2.Visible = bool.Parse(Request.QueryString["showImage2"]);
}
0
 
SimonPrice33Author Commented:
Thank you for your response, I see that you have provided a solution in c#, and apologise for not saying earlier, but I am writing in VB.NET.

I have tried the request.querystring as you suggest, however this is coming up with a value of type system.collections.specialised.namevaluecollection cannot be converted to string.

Any suggestions?

0
 
Nathan BoveSoftware EngineerCommented:
It has been quite some time since I have written VB.NET code, if I remember correctly, it would look something like this::
Sub Page_Load(ByVal Sender as Object, ByVal E as EventArgs)
  image1.Visible = Boolean.Parse(Request.QueryString("showImage1"))
  image2.Visible = Boolean.Parse(Request.QueryString("showImage2"))
End Sub
0
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

 
SimonPrice33Author Commented:
Hi,

after looking at your c# code yesterday I tried it this way and unfortunately it didnt work :(

I will continue to to try and modify this...

Thanks

Simon
0
 
SimonPrice33Author Commented:
have been unable to find a working solution so have given up on this idea... and will close the question.
0
 
SimonPrice33Author Commented:
.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now