Closing Page automatically after load.

Discussion in 'ASP .Net' started by jack, Jun 6, 2007.

  1. jack

    jack Guest

    I have created a form which generates an excel file from the dataset
    and is working fine.
    The only problem is after the excel is generated the blank page still
    exist on the screen.
    I tried a lot the unload it automatically by close window javascript
    to be called in the body tab of the page. but couldn't make it


    i would be glad to know the solution.
    Thanks for replying me
     
    jack, Jun 6, 2007
    #1
    1. Advertising

  2. jack skrev:
    > I have created a form which generates an excel file from the dataset
    > and is working fine.
    > The only problem is after the excel is generated the blank page still
    > exist on the screen.
    > I tried a lot the unload it automatically by close window javascript
    > to be called in the body tab of the page. but couldn't make it
    >
    >
    > i would be glad to know the solution.
    > Thanks for replying me
    >


    Hello Jack,

    you should be able to close the window by way of javascript. Can you
    post some of your code...?
     
    =?ISO-8859-1?Q?Morten_N=F8rgaard?=, Jun 6, 2007
    #2
    1. Advertising

  3. jack

    jack Guest

    strHeader.Append("<html><body onload='javascript:window.close();'>")

    This is what i am doing to create a excel page now the file gets
    created but even thought the event is set in the page load it is not
    getting closed.


    Please help
     
    jack, Jun 6, 2007
    #3
  4. jack

    jack Guest

    guys please help couldn't break the solution.
     
    jack, Jun 7, 2007
    #4
  5. jack

    Damien Guest

    On Jun 7, 10:25 am, jack <> wrote:
    > guys please help couldn't break the solution.


    Without being able to see any of your code, it's difficult to know how
    to help.

    At a wild guess, you've got a page (Page1.aspx) which contains a link
    to a second page (Page2.aspx). Page2.aspx creates the excel file and
    sends that as it's response, and marks the content disposition as an
    attachment (thus suggesting to the browser that it open the file in
    the appropriate application). However, the problem is that the link in
    Page1.aspx includes a target specification of _blank, and so when
    users are clicking on the link, it's opening a new browser window
    first.

    If all the above wild speculation is correct, then the fix is to
    remove the target="_blank". If it's not correct, maybe you can post
    some actual information that would allow us to see what the problem
    is?

    Damien
     
    Damien, Jun 7, 2007
    #5
    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. =?Utf-8?B?U2lsZWVzaA==?=
    Replies:
    4
    Views:
    33,925
    =?Utf-8?B?U29sZWwgU29mdHdhcmU=?=
    Oct 14, 2004
  2. =?Utf-8?B?Vk1J?=

    Closing popup window when closing parent window?

    =?Utf-8?B?Vk1J?=, Feb 14, 2007, in forum: ASP .Net
    Replies:
    3
    Views:
    657
    Thomas Hansen
    Feb 15, 2007
  3. subhadip
    Replies:
    0
    Views:
    646
    subhadip
    Mar 28, 2007
  4. thomas
    Replies:
    0
    Views:
    230
    thomas
    Oct 23, 2003
  5. Mike Dee
    Replies:
    3
    Views:
    324
    Mamidipalli
    Mar 1, 2006
Loading...

Share This Page