Re: cancel request

Discussion in 'ASP .Net' started by Ken Cox [Microsoft MVP], Apr 27, 2004.

  1. Hi Adrian,

    You'd get the best response from a client-side event which goes to the
    "Cancel" page directly without requiring a postback and the processing that
    it entails.

    You could do this by using an old-fashioned HTML button or a linke, or by
    inserting a little JavaScript into the server control like this:

    Private Sub Page_Load _
    (ByVal sender As System.Object, _
    ByVal e As System.EventArgs) _
    Handles MyBase.Load
    Button2.Attributes.Add("onclick", _
    "location.href='cancel.aspx';return false;")
    End Sub

    Ken
    Microsoft MVP [ASP.NET]



    "Adrian" <> wrote in message
    news:...
    >I have built an ASP.Net (VB.Net) application. When the user clicks to go
    >to a certain page, I need the ability to cancel the request to view the
    >page (on occasions) or at least redirect back to the previous (current
    >page)
    >
    > How do I do this?
    >
    > Many Thanks
     
    Ken Cox [Microsoft MVP], Apr 27, 2004
    #1
    1. Advertising

  2. Thanks Ken, however the logic which decides whether I perform some actions or no actions take place on the code-behind of the target page. And the request for the target page is done in javascript from a button on the source page, so I have no scope for putting logic on the source page?? Hope that makes sense
     
    =?Utf-8?B?QWRyaWFu?=, Apr 27, 2004
    #2
    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. Corey Olsen

    Bypass validation on cancel

    Corey Olsen, Jun 30, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    658
    Jurjen de Groot
    Jun 30, 2003
  2. Brian Birtle
    Replies:
    2
    Views:
    2,134
    John Saunders
    Oct 16, 2003
  3. Pavel Dvorkin

    cancel POST request

    Pavel Dvorkin, Jun 2, 2006, in forum: ASP .Net
    Replies:
    3
    Views:
    739
    Pavel Dvorkin
    Jun 2, 2006
  4. =?Utf-8?B?U2VyZ2V5IFp1eWV2?=

    Potentially dangerous Request.Form value for Cancel button Click

    =?Utf-8?B?U2VyZ2V5IFp1eWV2?=, Oct 5, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    517
    Jon Paal
    Oct 5, 2006
  5. =?Utf-8?B?T3Bh?=

    How to cancel http request from javascript

    =?Utf-8?B?T3Bh?=, May 12, 2007, in forum: ASP .Net
    Replies:
    4
    Views:
    2,018
    =?Utf-8?B?T3Bh?=
    May 12, 2007
Loading...

Share This Page