S
SteveSu
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
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