Question

I want to keep some informations in some TextBoxes if I go back to this page programmatically. On Page1 I enter the informations and if I click on the button I redirect to the next page, but if an error is in the informations (like text in TextBox for numbers only) I want to go back by clicking on a linkbutton. I tried:

prevPage = Request.UrlReferrer.ToString();
LinkButton1.PostBackUrl = prevPage;

But if get back to the previous page all textboxes are empty. By pressing BACKSPACE on the keyboard, all informations stay kept.

How can I programatically do this to keep the informations like if I am pressing BACKSPACE ???

Was it helpful?

Solution

Just try this javascript on link button click

history.back()

Example

<script>
function goBack()
  {
  window.history.back()
  }
</script>

<input type="button" value="Back" onclick="goBack()">
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top