VS 2010 - Go Back To Previous Page

Mar 25, 2012

I write this code to "page1.aspx"

Code:
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack) //check if the webpage is loaded for the first time.
{
Session["PreviousPage"] = Request.UrlReferrer.ToString();//Saves the Previous page url in ViewState
}
}

And when the page was in "page2.aspx" using this code

if (Session["PreviousPage"] != null)//Check if the ViewState contains Previous page URL
{
Response.Redirect(Session["PreviousPage"].ToString());//Redirect to Previous page by retrieving the PreviousPage Url from ViewState.
}

I encounter this issue.

Object reference not set to an instance of an object.

what should I do?

View 6 Replies


Similar Messages:

Forms Data Controls :: When Use The Previous Button To Navigate Back To The Previous Step The Page Reloads But At The Bottom Of The Page?

Aug 2, 2010

I'm using a wizard control with 4 steps, when I use the previous button to navigate back to the previous step the page reloads but at the bottom of the page.Instead of showning the whole of the page, the user views the footer of the site and the previous button and next button.I'm sure there is a very simple answer to this but I just can't figure out how to get the page to reload to the top.

View 8 Replies

When User Back Any Previous Tab(page) The Will Be Show The Previous Data Without Loading 2nd Time?

Jul 26, 2010

I am developing a web application in ASP.NET3.5 with C#. I also using Telerik RadAjax Control. When user click the menu then open the page with a new tab(Like web Browser).I want to create, when user back any previous tab(page) the will be show the previous data without loading 2nd time( like browser tab). Is it Possible ?

View 2 Replies

Javascript - How To Go Back To Previous Page While Retaining The Previous Page Data

Jan 5, 2011

I am having problem while using onclick="javascript:history.back();" with Aspnet. In the first page i filled some data and click search button it show some results, i click on particular result for its details which navigate to the 2nd page but when i click on custom back button it refresh the page and all data set to initial values,when i use onclick="javascript:history.back();" I get nothing but the page displays "webpage has expired."

View 1 Replies

Go Back To The Previous Page On Click Of Custom Back Button?

Aug 25, 2010

I am using an image button and on click of it i want to go to visited page.

Now i am using - Response.Redirect(Request.UrlReferrer.ToString()),

It is going to previous page, but when i am in a page of some user details where the link is looks like - users.aspx?userid=25 and i visit some other page and click back(image button) i want to see the same serdetail page. How to track that.

View 2 Replies

Web Forms :: Page Back Option And Edit Content Of That Previous Page

May 13, 2010

i am having three pages.first of all i fill register page it will redirected to next page .again i will fill this pageto move to next page. in this time i want to go back to previous page and want to edit content of that prevoius page.in this time i got one problem like"Violation of PRIMARY KEY constraint 'PK_Skills'. Cannot insert duplicate key in object 'dbo.Skills'. The statement has been terminated." how can i solve this problem.i am not having any primary key in my database.

View 6 Replies

Update Gridview And Go Back To The Previous Page?

Jul 29, 2010

I have a gridview, getting data from sql server, there is an Edit link to get the detailed information for example, for a user from database.

this link open a new page with detailed information and when I click the updated button,I want to go back to the same page with that users informaton.

I set the page size to 10, it means I can see only 10 users per page,and if I click the edit link on page 25,and update the users info, I want to go back to page 25.

Should I use viewstate or gridview has any commnad to go back to the same page? the code is written in ASP.net C# sqlserver,

View 1 Replies

Vb.net - Disable / Deny Going Back To Previous Page?

Apr 4, 2011

On my current project I want to deny going back once my customers hit submit button and redirected to the final page. How can I deny from going back to previous page or some mechanism to expire the page if the back button is clicked. I tried this code and it didn't work

page.response.cache.setcacheability(httpcacheability.nocache)

View 1 Replies

How To Preserve The Value Of The Previous Page After Clicking On Back Button

Apr 7, 2010

we are making an application in asp.net(visual studio 2008). In this we have made a page in which we have a submit button. on clicking on this submit button we go to next page.on this next page we have a back button.we want that when we click on this back button then the values that we have entered in the previous page is preserved(i.e displayed on the controls in which we have filled).

View 2 Replies

User Controls :: How To Go Back To Previous Page With Parameter

Apr 27, 2016

i'm a beginner in asp.net  and c# , i have a question :i have 2 pages :

1- localhost:12345/show_profile.aspx?id=35 

1- localhost:12345/Edit_profile.aspx ( with save button )

i try to redirect 2nd page with parameter (?id=35 ) after button clicked with Delay 3 sec .i can assign the url to var with url.Ref function ,  and call it but with out delay.

View 1 Replies

Web Forms :: How To Back To The Real Redirect Previous Page With The Same Parameter

Jan 14, 2010

I use button " text=Back" and in the code i write the ...

Response.Redirect("show_pro.aspx");

and this page "show_pro.aspx" is linked with tow pages send value in manner "Get"

ex:
show_pro.aspx?id={0}
show_pro.aspx?pic={0}
the question :

How can i back to the real redirect previous page with the same parameter send when i click button ' back '?

what can i write instead of this code ....... Response.Redirect("show_pro.aspx"); ??

note : i use c# coding

View 12 Replies

Web Forms :: Go Back To The Previous Page Without Loosing Searching Criteria?

Oct 18, 2010

I'll try to specify my problem as simple as possible! I have a problem comunicating between 2 pages; Products.aspx and ProductDetail.aspx. On Products.aspx i have about 15 DDL's on the left side (all set to autopostback), and 1 ListView ond the right side. Results in my ListView control are based on selcted items from DLL's on the left. Every single result in Products.aspx has a dynamical hyperlink to the ProductDetail.aspx. Now when I click on specific product in ListView I'm redirected to ProductDetail.aspx page, and everything works fine! If I click on the Back button in IE or FF it works also fine because it returns me to the previous Products.aspx page and all my results based on selected items in DDL's are still there!

The problem comes when causing some more autopostback's in ProductDetail.aspx page, because every autopostback is counted as a new page request and therefore i have to click Back button in IE or FF for more then 1 time to come back to the previous Products.aspx page.

I tried to implement code BELOW in ProductDetail.aspx.vb but it does not completly fulfill my expectations, becase all my searching criteria are lost when returned to the previous page (Products.aspx)

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
ViewState("ReferrerUrl") = Request.UrlReferrer.ToString
End If
End Sub
Protected Sub BACK_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles BACK.Click
Response.Redirect(ViewState("ReferrerUrl").ToString)
End Sub

Does anybody knows any other solution how to come Back to previous page with only ONE CLICK without loosing searching criteria?

View 5 Replies

Web Forms :: When Press Back Button The Previous Page Textbox Value Should Be Visible?

Jan 25, 2010

when press back button the previous page control value erased..but I want the control value should be visible.

View 4 Replies

Security :: When Clicking On Back Button After Logout Still Opens The Previous Page

Sep 15, 2010

I am using ASP.NET, the web page is abandoning and clear session when a user click logout link but they click the back button and it is still showing the previous page. How can it prevent the previous page after logout? on Logout.aspx load im using this code

Session.Clear();
Response.Buffer = true;
Response.ExpiresAbsolute = DateTime.Now.AddDays(-1D);
Response.Expires = -1500;
Response.CacheControl = "no-cache";
//----- Second Technique : To Stop Caching of Secure Pages.
Response.Cache.SetCacheability(HttpCacheability.NoCache);
FormsAuthentication.SignOut();
if (Session["UserName"] == null)
{
Response.Redirect("login.aspx");
}
Session.Clear();

View 4 Replies

Clicking Browser Back Button Is Opening A Link In The Previous Page?

Apr 22, 2010

I am using the below code

[Code]....

In the page there are two links. When i click the first link it opens a window in a new page. I do this by using the above code.

I am clicking the second link in the page and navigating to another page. Now i am clicking the browser back button. Supprisingly its opening the first link.

How clicking back button is opening the link in the page. I am using c# .net 2005.

View 1 Replies

Web Forms :: Pressing Back On Internet Explorer - Previous Page Appears

Jul 18, 2010

I have an ASP.NET problem. When I press Back on Internet explorer, the previous page will be appeared. I need to prevent this page form appearing. How can I do this

View 3 Replies

Forms Data Controls :: Go Back To Parent Page In Previous State?

Apr 6, 2010

Considering three webpages. In all pages there are gridivews. The gridview columns has numeric data.

When user click on data figure suppose 29 then it redirects to other page with 29 records. In the redirected page if user again click on data suppose 12 then it redirects to another page with 12 records.

I want to give option to user that if form third page he wants to go back by clicking a hyperlink on that page then the second should appear in its previous state i.e. have showing the clicked value 29 and if he wants to go the first page then first page should keep and display its previous state with the searched data.

Page1>Page2>Page3
Page1<Page2<Page3

View 33 Replies

Forms Data Controls :: Update The Gridview And Go Back To The Previous Page?

Jul 29, 2010

I have a gridview, getting data from sql server, there is an Edit link to get the detailed information for example, for a user from database.

this link open a new page with detailed information and when I click the updated button,I want to go back to the same page with that users informaton.

I set the page size to 10, it means I can see only 10 users per page,and if I click the edit link on page 25,and update the users info, I want to go back to page 25.

Should I use viewstate or gridview has any commnad to go back to the same page? the code is written in ASP.net C# sqlserver,

View 3 Replies

Web Forms :: Implement Back Button Functionality - Redirect To Previous Page

Mar 9, 2013

I have 3 page

1-admin.aspx

2-Search.aspx

3-register.aspx

In admin.aspx and Search.aspx I have button that when users click On button they go to register.aspx

I put one image button=IMGBack in register.aspx that I want when users click on it they back to lastpage

I mean if they was in admin.aspx when they click on IMGBack they back to admin.aspx page and if they was in search.aspx they back to search.aspx  page

I want do some thing  like this button (<--) in google toolbar when we click on this button we come back to last page that we visited.

View 1 Replies

Web Forms :: Disable Back Button - Unable To Reach Previous Page After Logout?

Aug 20, 2010

disable back button on my asp.net application. I Should not be able to go back to my previous page after I logout.

View 2 Replies

AJAX :: Using Browser Back To Previous Page Containing Gridview Inside Update Panel?

Aug 6, 2010

Looking for the best technique on handling or at least some documentation showing an example.

Starting Page

Gridview control withing an update panel (also various controls used for filtering NOT IN UPDATE PANEL)

Databinding does not happen during page load.

Databinding is initiated when update panel trigger (asp:Button object) is clicked

Hyperlink column is added to returned records

Hyperlink posts to a separate page for detail for record which the hyperlink was clicked.

Second Page

While navigating via the browser back button to previous page (which contained the update panel and gridview) only the (various controls used for filtering) have retained state. The gridview is not shown (which is how the page loads initially when starting) How can I retain the state of the Gridview and add a step in the browser history all together?

View 8 Replies

Click On Back In Page B.aspx It Comes To A.aspx With Out Previous Listview Result

Aug 27, 2010

I have page A.aspx where I show some result in listview. When I click On Some data on listview I go to page B.aspx. Now the problem is when I click on back in page B.aspx it comes to A.aspx with out previous listview result. Ack requirement is when I come to page A.aspx result of listview has to be there. How do i do that?

View 2 Replies

User Controls :: How To Prevent User To Go Back Previous Page In Webform

Oct 21, 2015

I have a login page and a dashboard page. Now user first login and then redirect to dashboard page. User press browser Back navigate button and now it's again on login page.

View 1 Replies

Back Button Navigates To Previous

Mar 27, 2010

In attendance page there is two button In and Out visible any one of them at a time while i am pressing back button it navigates to previous button instead of previous page.

View 1 Replies

Vb.net - Go Back To The Previous Row Usning DataReader?

Jun 18, 2010

How can I go back to the previous row using OleDbDataReader.I know that DataReader just advance to the next row using DataReader.Read(),but how can I go back to the previous row.

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved