WebForm's Response.Write to create pop up window for printing repo

Discussion in 'ASP .Net' started by =?Utf-8?B?RXJpYw==?=, Jan 20, 2005.

  1. I want to create a pop up window for printing report, but I encounter some
    problem.
    (1). If use showModalDialog, then the toolbar of the browser is missing,
    can i display the print toolbar for user to print the report ?
    (2). I finally come up with the below solution, however I have to use
    "setTimeout"
    in order to show the popup form on top of the parent form.
    Is there any way to skip using the setTimeout method ?

    strPopup = "<script language='javascript'>var
    newwin=window.open('Rpt_Friendly_DNote.aspx?Param1=" &
    strAirWayBillNbr & "'); " & _
    "newwin.window.moveTo(0,0); " & _
    "newwin.window.resizeTo(screen.availWidth,
    screen.availHeight); " & _
    "setTimeout('newwin.focus()',50); " & _
    "</script>"

    Response.Write(strPopup)
    =?Utf-8?B?RXJpYw==?=, Jan 20, 2005
    #1
    1. Advertising

  2. You can print from a modal dialog. Just add a "Print" button to the page and
    call window.print() in onclick event. Hide the button in onbeforeprint
    event, and show it again in onafterprint.

    Eliyahu

    "Eric" <> wrote in message
    news:...
    > I want to create a pop up window for printing report, but I encounter some
    > problem.
    > (1). If use showModalDialog, then the toolbar of the browser is missing,
    > can i display the print toolbar for user to print the report ?
    > (2). I finally come up with the below solution, however I have to use
    > "setTimeout"
    > in order to show the popup form on top of the parent form.
    > Is there any way to skip using the setTimeout method ?
    >
    > strPopup = "<script language='javascript'>var
    > newwin=window.open('Rpt_Friendly_DNote.aspx?Param1=" &
    > strAirWayBillNbr & "'); " & _
    > "newwin.window.moveTo(0,0); " & _
    > "newwin.window.resizeTo(screen.availWidth,
    > screen.availHeight); " & _
    > "setTimeout('newwin.focus()',50); " & _
    > "</script>"
    >
    > Response.Write(strPopup)
    >
    Eliyahu Goldin, Jan 20, 2005
    #2
    1. Advertising

  3. Re: WebForm's Response.Write to create pop up window for printing

    Thanks. But can I have a Print Preview function as well ???



    "Eliyahu Goldin" wrote:

    > You can print from a modal dialog. Just add a "Print" button to the page and
    > call window.print() in onclick event. Hide the button in onbeforeprint
    > event, and show it again in onafterprint.
    >
    > Eliyahu
    >
    > "Eric" <> wrote in message
    > news:...
    > > I want to create a pop up window for printing report, but I encounter some
    > > problem.
    > > (1). If use showModalDialog, then the toolbar of the browser is missing,
    > > can i display the print toolbar for user to print the report ?
    > > (2). I finally come up with the below solution, however I have to use
    > > "setTimeout"
    > > in order to show the popup form on top of the parent form.
    > > Is there any way to skip using the setTimeout method ?
    > >
    > > strPopup = "<script language='javascript'>var
    > > newwin=window.open('Rpt_Friendly_DNote.aspx?Param1=" &
    > > strAirWayBillNbr & "'); " & _
    > > "newwin.window.moveTo(0,0); " & _
    > > "newwin.window.resizeTo(screen.availWidth,
    > > screen.availHeight); " & _
    > > "setTimeout('newwin.focus()',50); " & _
    > > "</script>"
    > >
    > > Response.Write(strPopup)
    > >

    >
    >
    >
    =?Utf-8?B?RXJpYw==?=, Jan 21, 2005
    #3
  4. Re: WebForm's Response.Write to create pop up window for printing

    No, this you can't have.

    Eliyahu

    "Eric" <> wrote in message
    news:...
    > Thanks. But can I have a Print Preview function as well ???
    >
    >
    >
    > "Eliyahu Goldin" wrote:
    >
    > > You can print from a modal dialog. Just add a "Print" button to the page

    and
    > > call window.print() in onclick event. Hide the button in onbeforeprint
    > > event, and show it again in onafterprint.
    > >
    > > Eliyahu
    > >
    > > "Eric" <> wrote in message
    > > news:...
    > > > I want to create a pop up window for printing report, but I encounter

    some
    > > > problem.
    > > > (1). If use showModalDialog, then the toolbar of the browser is

    missing,
    > > > can i display the print toolbar for user to print the report ?
    > > > (2). I finally come up with the below solution, however I have to

    use
    > > > "setTimeout"
    > > > in order to show the popup form on top of the parent form.
    > > > Is there any way to skip using the setTimeout method ?
    > > >
    > > > strPopup = "<script language='javascript'>var
    > > > newwin=window.open('Rpt_Friendly_DNote.aspx?Param1=" &
    > > > strAirWayBillNbr & "'); " & _
    > > > "newwin.window.moveTo(0,0); " & _
    > > > "newwin.window.resizeTo(screen.availWidth,
    > > > screen.availHeight); " & _
    > > > "setTimeout('newwin.focus()',50); " & _
    > > > "</script>"
    > > >
    > > > Response.Write(strPopup)
    > > >

    > >
    > >
    > >
    Eliyahu Goldin, Jan 21, 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. Luke
    Replies:
    3
    Views:
    388
    Jeroen Ruigrok van der Werven
    Jan 17, 2008
  2. Paul
    Replies:
    6
    Views:
    3,051
    A6034447
    Nov 26, 2009
  3. JB
    Replies:
    2
    Views:
    1,752
  4. Julian
    Replies:
    1
    Views:
    402
    Chris Withers
    Oct 8, 2010
  5. Madame Blablavatsky
    Replies:
    8
    Views:
    155
    Dr John Stockton
    Sep 16, 2005
Loading...

Share This Page