-
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 !
-
api isnt going to do you any good. all you can do is javascript print function
window.print();
-
try JavaScript.... window.print()
-
hey i was going to say that
-
this is important if you had tried to use api it would have opened a print dialog on the server not the client......
-
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
-
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
-
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.
-