Results 1 to 9 of 9

Thread: Print ASPX

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2004
    Posts
    5

    Print ASPX

    Need Help !
    I want to run the printer dialog in IE but in the aspx pages mwe dont have access to the print dialog box.

    So i want to press a Print button in form and see the beautiful print dialog box .

    I search a lot for Windows XP API and i way to uses this function but the only thing i found its pages that want my money in exchange of help

    Plz help me !
    Help !

  2. #2
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    api isnt going to do you any good. all you can do is javascript print function

    window.print();
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  3. #3
    Frenzied Member Magiaus's Avatar
    Join Date
    Mar 2002
    Location
    swamp land
    Posts
    1,267
    try JavaScript.... window.print()
    Magiaus

    If I helped give me some points.

  4. #4
    Frenzied Member Magiaus's Avatar
    Join Date
    Mar 2002
    Location
    swamp land
    Posts
    1,267
    hey i was going to say that
    Magiaus

    If I helped give me some points.

  5. #5
    Frenzied Member Magiaus's Avatar
    Join Date
    Mar 2002
    Location
    swamp land
    Posts
    1,267
    this is important if you had tried to use api it would have opened a print dialog on the server not the client......
    Magiaus

    If I helped give me some points.

  6. #6

    Thread Starter
    New Member
    Join Date
    Feb 2004
    Posts
    5
    Private Sub btnAccept_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAccept.Click
    If (btnAccept.Text = "Print") Then
    btnAccept.Text = "Request another"
    Response.Write("window.print()")

    Else
    btnAccept.Text = "print"
    Response.Write("<SCRIPT>")
    Response.Write("window.print();")
    Response.Write("</SCRIPT>") End If
    End Sub

    Now my question is :
    How do i execute this -> Response.Write("window.print();")
    if i press this button btnAccept_Click, it write window.print(); it only write this in the aspx page but it didn't execute it
    Help !

  7. #7
    Frenzied Member Magiaus's Avatar
    Join Date
    Mar 2002
    Location
    swamp land
    Posts
    1,267
    Code:
    <html>
    <head><title>Print</title></head>
    <script language="javascript">
        function showPrint(){window.print();}
    </script>
    <body>
        <div id="anyhtml_element" height="25px" width="100px" onclick="showPrint();">Print</div><!-- the ; in onclick may cause script to fail in early versions of netscape !@#$%^ netscape -->
    </body>
    </html>
    web programming is not about Response.Write it is about html, css and javascript (maybe vbscript too but @#$%^&* netscape) yes asp.net does wonders for dynamicly creating html, css, and javascrpt and fetching data but the actual web page still has to be those other things that conect up and work together on the client not the server
    Magiaus

    If I helped give me some points.

  8. #8
    Frenzied Member Magiaus's Avatar
    Join Date
    Mar 2002
    Location
    swamp land
    Posts
    1,267

    about your code

    I think I see what you tried to do but what you need is what my example shows forgrtt asp the script is client not server and why postback to the server to response. write that bit of clientside script? I think you need to read up on web programming because the way your going your going to kill that server. What if 100 people clicked the print button at once that would be 100 postback and re runs of the aspx code just to try to execute a script that should be on the client. Never use aspx to do what the browser alone can do.
    Magiaus

    If I helped give me some points.

  9. #9

    Thread Starter
    New Member
    Join Date
    Feb 2004
    Posts
    5
    thnx Alot
    Help !

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width