364,033 Members | 4721 Browsing Online
Community for Developers & IT Professionals
Bytes IT Community

How to clear postbacks from window.history?

=?Utf-8?B?Y2FzaGRlc2ttYWM=?=
P: n/a
=?Utf-8?B?Y2FzaGRlc2ttYWM=?=
Hi,

Is it possible to clear the recent history so that a link with the href
"javascript:window.history.back()" doesn't record any postbacks?

For example, if I the user makes a few selections on a page and clicks the
Back link, I want them to go to the previous page rather than going to the
previous state of the page.

Any help is appreciated as always.
Dec 14 '07 #1
Share this Question
Share on Google+
2 Replies


andrew.douglas11@gmail.com
P: n/a
andrew.douglas11@gmail.com
One way that you could solve your problem is to use the AJAX
Extensions. After you install the AJAX Extensions, if you put content
inside of an UpdatePanel control, and the user clicks something inside
it, a PostBack will still occur, but only the portion of the screen
contained in the UpdatePanel will be refreshed after the PostBack. So
if you click the Back button, it will act as if the PostBack never
happened. Here's some code for you:

<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Label ID="lblTime" runat="server"></asp:Label>
<asp:Button ID="btnRefreshUpdatePanel" runat="server"
Text="Do PostBack" />
</ContentTemplate>
</asp:UpdatePanel>

If you have a page foo.html that links to a page foo.aspx which
contains the above UpdatePanel, the user can click the "Do PostBack"
button as many times as they want, and you can still press the
browser's Back button to get back to foo.html.

Hope this helps
Andy

On Dec 14, 8:21 am, cashdeskmac
<cashdesk...@discussions.microsoft.comwrote:
Hi,
>
Is it possible to clear the recent history so that a link with the href
"javascript:window.history.back()" doesn't record any postbacks?
>
For example, if I the user makes a few selections on a page and clicks the
Back link, I want them to go to the previous page rather than going to the
previous state of the page.
>
Any help is appreciated as always.
Dec 14 '07 #2

=?Utf-8?B?Y2FzaGRlc2ttYWM=?=
P: n/a
=?Utf-8?B?Y2FzaGRlc2ttYWM=?=
Fantastic. Thank you very much. :-)

"andrew.douglas11@gmail.com" wrote:
One way that you could solve your problem is to use the AJAX
Extensions. After you install the AJAX Extensions, if you put content
inside of an UpdatePanel control, and the user clicks something inside
it, a PostBack will still occur, but only the portion of the screen
contained in the UpdatePanel will be refreshed after the PostBack. So
if you click the Back button, it will act as if the PostBack never
happened. Here's some code for you:
>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Label ID="lblTime" runat="server"></asp:Label>
<asp:Button ID="btnRefreshUpdatePanel" runat="server"
Text="Do PostBack" />
</ContentTemplate>
</asp:UpdatePanel>
>
If you have a page foo.html that links to a page foo.aspx which
contains the above UpdatePanel, the user can click the "Do PostBack"
button as many times as they want, and you can still press the
browser's Back button to get back to foo.html.
>
Hope this helps
Andy
>
On Dec 14, 8:21 am, cashdeskmac
<cashdesk...@discussions.microsoft.comwrote:
Hi,

Is it possible to clear the recent history so that a link with the href
"javascript:window.history.back()" doesn't record any postbacks?

For example, if I the user makes a few selections on a page and clicks the
Back link, I want them to go to the previous page rather than going to the
previous state of the page.

Any help is appreciated as always.
>
>
Dec 14 '07 #3

Post your reply

Help answer this question



Didn't find the answer to your ASP.NET question?

You can also browse similar questions: ASP.NET