Thanks for the reply.
This is not the case. I have steped through the code in the debugger
som I know that the response.redirect line is executed.
The strange thing is that it does not seems to be an ordinary postback,
cause if I for example change the text-value for a label, the value is
not changed when the page is shown again.
I have tested the same thing for a LinkLabel. First I add a linklabel
to the page. In the event for the linklabel I have added a
response.redirect. This works fine if I click on the link, but if I
call it from a javascript method like __doPostBack('LinkButton1', '')
the event is called but no response.redirect is done. What is the
difference between this scenarios?
George wrote:
Response.Reddirect is simply not executed.
Most likely IsPostBack return false.
Leve the code like that
If Request.Form("__EVENTARGUMENT") = "myRedirect" Then
response.redirect("anotherPage.aspx")
End If
you do not need to check on PostBack
George.
"SteveSu" <ss*********@hotmail.com> wrote in message news:11**********************@g44g2000cwa.googlegr oups.com...
Hi!
I want to make a postback when the user hits the escape-button on the
keyboard and redirect the user to another page. But the
response.redirect does not work for me in this "context".
I´m trying to do like this:
<body onkeydown="MyRedirect()">
function MyRedirect()
{
if(event.keyCode == 27)
{
__doPostBack('', 'myRedirect');
}
}
--
The doPostBack method is autogenerated by .net and look like this in
.net 2.0.
--
function __doPostBack(eventTarget, eventArgument) {
if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
theForm.__EVENTTARGET.value = eventTarget;
theForm.__EVENTARGUMENT.value = eventArgument;
theForm.submit();
}
}
--
This will trigger a postback.
In page_load I´m doing like this:
Private Sub Page_Load(...) Handles Me.Load
If Page.IsPostBack Then
If Request.Form("__EVENTARGUMENT") = "myRedirect" Then
response.redirect("anotherPage.aspx")
End If
End If
End Sub
Nothing happens when executing response.redirect. Why is that?
Thanks in advance
/ Steve