DreamTeK
DreamTeK

Reputation: 34287

Make page content visible after a redirect. ASP.NET

How can a page show additional content if it is redirected from another page.

I have currently:

<asp:panel runat="server" visible="true">
MY NORMAL CONTENT SHOWN AT PAGE LOAD
</asp:panel>

<asp:panel runat="server" visible="false">
A MESSAGE THAT LOADS WHEN THE USER ARRIVES HERE FROM A CERTAIN PAGE
</asp:panel>

QUESTION

HOW CAN I INVERT THE VISIBILITY OF THE TWO DIVS WHEN THE USER IS SENT HERE FROM ANOTHER PAGE VIA RESPONCE.REDIRECT?

OR Alternate suggestions to produce a similar effect.

(In VB please).

Upvotes: 0

Views: 1047

Answers (4)

OuSs
OuSs

Reputation: 444

Add ID parameter to your panels (suppose Panel1 , Panel2)

You can simple pass a parameter in the url in the Response.Redirect("MyPage?ShowPanel=1")

And read it in the other page :

If Request.QueryString("ShowPanel") = "1" Then
Panel1.Visible = False
Panel2.Visible = True
End If

Upvotes: 1

chead23
chead23

Reputation: 1879

You can check the value of Request.UrlReferrer in your code behind then set the visibility of the panels based on that.

Upvotes: 0

Grant Thomas
Grant Thomas

Reputation: 45068

There are a number of possibilities, using a value in the URL or the server Session, for instance. For this example I'd go with a query string value since the content of the page is distinct under certain circumstances, so give it a unique URL. For example, append ?discriminator=value to the redirect URL.

Upvotes: 2

Sandip
Sandip

Reputation: 987

try Request.UrlReferrer you will get url from where the page is redirected. you can set your conditions based on that. if it's null means the page is not redirected from anywhere. the page is opened itself by writing url.

Upvotes: 0

Related Questions