__doPostBack and Response.direct not working in non-framed pages.

G

Guest

Hello!
I have written a javascript which posts back a page with __doPostBack if a
user presses the escape-button on the keyboard. Then in Page_Load I´m doing a
response.redirect to another page.

This scripts only works for me if the page (which had the page_load with the
response.redirect) is in a frameset environment. If the page is not in
frameset, then the postback works fine but nothing happens when doing
response.redirect.

Why is that?

My code:

document.onkeydown=function MyRedirect()
{
if(event.keyCode == 27)
{
__doPostBack('', 'myRedirect');
}


}


--
The doPostBack method is autogenerated by .net. I´m using .net 2.0.
--

VB.Net code:
-------------
Private Sub Page_Load(...) Handles Me.Load

If Request.Form("__EVENTARGUMENT") = "myRedirect" Then
response.redirect("anotherPage.aspx")
End If

End Sub


Thanks in advance
/ Stefan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,810
Latest member
Kassie0918

Latest Threads

Top