S
ShaneFowlkes
I created a couple of quick test pages and to my surprise, these do not work
either. When I click "Go Back" on test2.aspx, nothing happens. Ideas??
Surely I must be missing something obvious.....
Thanks
PAGE 1 - test.aspx
<%@ Page Language="VB" %>
<script runat="server">
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As
System.EventArgs)
Response.Redirect("test2.aspx")
End Sub
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form runat="server">
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Go" />
</form>
</body>
</html>
PAGE 2 - test2.aspx
<%@ Page Language="VB" %>
<script runat="server">
Sub page_load(ByVal Sender As Object, ByVal E As EventArgs)
Button1.Attributes.Add("onclick", "javascript:history.go(-1);")
End Sub
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form runat="server">
<asp:Button ID="Button1" runat="server" Text="Go Back" />
</form>
</body>
</html>
**********************************************
Original post:
Somethinng odd is happening. I have a form button and on page load, I add a
javascript "back" function to this button. Like so:
btnCancel.Attributes.Add("onclick", "javascript:window.history.go(-1);")
<asp:Button ID="btnCancel" runat="server" Text="Cancel and go back." />
This generates the following html when rendered:
<input type="submit" name="btnCancel" value="Cancel and go back."
onclick="javascript:window.history.go(-1);" id="btnCancel" />
Yet, it doesn't work in IE6 or FF 1.5. Nothing happens. The page just
seems to post to itself. I've also tried changing the history.go value
to -2 and still get the same effect.
Any ideas? I'm using asp.net 2 (vb)
Thanks
either. When I click "Go Back" on test2.aspx, nothing happens. Ideas??
Surely I must be missing something obvious.....
Thanks
PAGE 1 - test.aspx
<%@ Page Language="VB" %>
<script runat="server">
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As
System.EventArgs)
Response.Redirect("test2.aspx")
End Sub
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form runat="server">
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Go" />
</form>
</body>
</html>
PAGE 2 - test2.aspx
<%@ Page Language="VB" %>
<script runat="server">
Sub page_load(ByVal Sender As Object, ByVal E As EventArgs)
Button1.Attributes.Add("onclick", "javascript:history.go(-1);")
End Sub
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form runat="server">
<asp:Button ID="Button1" runat="server" Text="Go Back" />
</form>
</body>
</html>
**********************************************
Original post:
Somethinng odd is happening. I have a form button and on page load, I add a
javascript "back" function to this button. Like so:
btnCancel.Attributes.Add("onclick", "javascript:window.history.go(-1);")
<asp:Button ID="btnCancel" runat="server" Text="Cancel and go back." />
This generates the following html when rendered:
<input type="submit" name="btnCancel" value="Cancel and go back."
onclick="javascript:window.history.go(-1);" id="btnCancel" />
Yet, it doesn't work in IE6 or FF 1.5. Nothing happens. The page just
seems to post to itself. I've also tried changing the history.go value
to -2 and still get the same effect.
Any ideas? I'm using asp.net 2 (vb)
Thanks