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. Advertisements

  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. Advertisements

  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. Advertisements

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. Sriram Mallajyosula

    How do I post data from aspx page to another aspx page.

    Sriram Mallajyosula, Nov 5, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    1,270
    Steve C. Orr [MVP, MCSD]
    Nov 5, 2003
  2. Marco Antonio Montalvo Durán
    Replies:
    2
    Views:
    4,612
    Matt Morris
    Jan 23, 2004
  3. =?Utf-8?B?Uk1M?=
    Replies:
    1
    Views:
    731
    =?Utf-8?B?QW5keSBMdWtzaWM=?=
    Sep 16, 2005
  4. Progman
    Replies:
    2
    Views:
    2,151
    =?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=
    Feb 13, 2006
  5. uto
    Replies:
    3
    Views:
    831
    Michael Hamrah
    Mar 8, 2006
  6. MadHatter51
    Replies:
    1
    Views:
    1,138
    Hakan Lambracht
    May 17, 2006
  7. S_K
    Replies:
    1
    Views:
    533
    IfThenElse
    Oct 2, 2007
  8. Iñaki Baz Castillo
    Replies:
    7
    Views:
    1,297
    Iñaki Baz Castillo
    Jan 12, 2010
Loading...