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

Discussion in 'ASP .Net' started by =?Utf-8?B?Q2xhcw==?=, Nov 10, 2005.

  1. 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
     
    =?Utf-8?B?Q2xhcw==?=, Nov 10, 2005
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. SteveSu
    Replies:
    2
    Views:
    17,208
    SteveSu
    Nov 8, 2005
  2. Bruno Köller
    Replies:
    5
    Views:
    1,029
  3. newbieTW

    js not working when framed

    newbieTW, Jan 5, 2004, in forum: Javascript
    Replies:
    0
    Views:
    166
    newbieTW
    Jan 5, 2004
  4. Ricardo Garcia

    about NOT getting framed

    Ricardo Garcia, Sep 23, 2004, in forum: Javascript
    Replies:
    1
    Views:
    105
    kaeli
    Sep 23, 2004
  5. Replies:
    2
    Views:
    157
    Thomas 'PointedEars' Lahn
    Aug 22, 2007
Loading...

Share This Page