force close the aspx page.

Discussion in 'ASP .Net' started by Eitan, Jun 5, 2005.

  1. Eitan

    Eitan Guest

    Hello,
    How can I close the aspx by force (with some commands) ?

    Thanks :)
     
    Eitan, Jun 5, 2005
    #1
    1. Advertising

  2. client side javascript

    window.close();

    Once the page has been delivered to the browser. The server
    cannot send a command to it until the client sends another request.

    So, you have to do this client side in some fashion.

    --
    2004 and 2005 Microsoft MVP C#
    Robbe Morris
    http://www.robbemorris.com
    http://www.masterado.net



    "Eitan" <> wrote in message
    news:...
    > Hello,
    > How can I close the aspx by force (with some commands) ?
    >
    > Thanks :)
    >
     
    Robbe Morris [C# MVP], Jun 5, 2005
    #2
    1. Advertising

  3. Eitan

    Eitan M Guest

    What I did,
    on page_load event, I added the code :

    Dim btn As Button

    btn = CType(btnOK, Button)

    btn.Attributes.Add("onclick", _

    String.Format("window.close();"))



    Dialog truely close, thanks.

    (so there are event onclick on the client, and onclick on the server).

    One problem is that just after closing the dialog,

    the contents of the dialog appear in a new window (In IE web browser),

    Which I don't want that this will happen.



    What may be wrong ?



    Thanks :)
     
    Eitan M, Jun 5, 2005
    #3
  4. Eitan

    Eitan M Guest


    > What I did,
    > on page_load event, I added the code :
    >
    > Dim btn As Button
    >
    > btn = CType(btnOK, Button)
    >
    > btn.Attributes.Add("onclick", _
    >
    > String.Format("window.close();"))
    >
    >
    >
    > Dialog truely close, thanks.
    >
    > (so there are event onclick on the client, and onclick on the server).
    >
    > One problem is that just after closing the dialog,
    >
    > the contents of the dialog appear in a new window (In IE web browser),
    >
    > Which I don't want that this will happen.
    >
    >
    >
    > What may be wrong ?


    Also I don't want that on_load event occurs just after pressing the
    server-side button.

    Thanks :)
     
    Eitan M, Jun 5, 2005
    #4
    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. T. Seaburn

    force aspx page in new viewer?

    T. Seaburn, Aug 28, 2004, in forum: ASP .Net
    Replies:
    6
    Views:
    637
    =?Utf-8?B?d2hpZ2dpbnM=?=
    Sep 2, 2004
  2. John M

    force refreshing of an aspx page

    John M, May 16, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    1,656
    Karl Seguin
    May 16, 2005
  3. William LaMartin

    Force aspx page to load from server--not cache

    William LaMartin, Jun 21, 2008, in forum: ASP .Net
    Replies:
    1
    Views:
    583
    William LaMartin
    Jun 21, 2008
  4. Iñaki Baz Castillo
    Replies:
    7
    Views:
    921
    Iñaki Baz Castillo
    Jan 12, 2010
  5. Martin

    Force browser to close after a delay?

    Martin, Mar 7, 2006, in forum: Javascript
    Replies:
    6
    Views:
    134
    Jonas Raoni
    Mar 8, 2006
Loading...

Share This Page