|
-
Aug 13th, 2008, 10:58 AM
#1
Thread Starter
PowerPoster
[RESOLVED] [2005] I have a Cancel button that wants to navigate back
I thought this code would make that happen:
Code:
Protected Sub btnCancel_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnCancel.Click
' Dim script As String = "<script>history.go(-1);</script>"
' Page.RegisterStartupScript("backupPage", script)
ClientScript.RegisterClientScriptBlock( _
Me.GetType, _
"GoinBack", _
"<script type='text/JavaScript'>history.go(-1)</script>")
End Sub
Nothing is happening. I am not going back, there is no javascript error, it just posts back and stays on the same page. Do you see what's wrong? Thanks.
-
Aug 13th, 2008, 11:05 AM
#2
Thread Starter
PowerPoster
Re: [2005] I have a Cancel button that wants to navigate back
I'm sorry. I actually just realized I want to call it at the client because why would I post back to the server just to navigate back? I'll try it there.
-
Aug 13th, 2008, 11:07 AM
#3
Re: [2005] I have a Cancel button that wants to navigate back
not sure whats worng with above but i would do this way
in page load event
Code:
btnCancel.Attributes.Add("onclick", "javascript:history.go(-1)")
__________________
Rate the posts that helped you 
-
Aug 13th, 2008, 11:13 AM
#4
Thread Starter
PowerPoster
Re: [2005] I have a Cancel button that wants to navigate back
That's not working. Not only does it post back, but it is not navigating back. Same as my original problem.
-
Aug 13th, 2008, 11:19 AM
#5
Thread Starter
PowerPoster
Re: [2005] I have a Cancel button that wants to navigate back
All better:
Code:
btnCancel.Attributes.Add("onclick", "javascript:history.go(-1);return false")
Thanks, riteshjain1982 - as helpful as always !
-
Aug 13th, 2008, 11:21 AM
#6
Re: [RESOLVED] [2005] I have a Cancel button that wants to navigate back
opps i forgot to add return false.
Code:
btnCancel.Attributes.Add("onclick", "javascript:history.go(-1);return false")
__________________
Rate the posts that helped you 
-
Aug 13th, 2008, 11:22 AM
#7
Re: [RESOLVED] [2005] I have a Cancel button that wants to navigate back
you beat me
__________________
Rate the posts that helped you 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|