NBilly
asked on
Print an aspx page
I created aspnet aspx page that displays information. I want to put a button on the page to print the content of the aspx page. What coding do I need to do this.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
No in the head of the .aspx page. It is javascript code.
ASKER
Do I create a button control on the aspx page. I want to put a button control on aspx page and when I click on that button have it print the content of the page.
Also, is the <form> and </form> in code my aspx file name.
Also, is the <form> and </form> in code my aspx file name.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
mmarksbury,
Your suggestion works. Now I just want to position that "Pring Page" button in certain place on the aspx page. How do I do that?
Your suggestion works. Now I just want to position that "Pring Page" button in certain place on the aspx page. How do I do that?
Wherever you put the <INPUT> tag, it should display there.
If you want to add padding, or align it, put it inside of a div and add CSS styling.
For example...
TO ALIGN IT RIGHT:
<div id="ButtonDiv" style="text-align: right;">
<input type="button" name="PrintButton" onclick="javascript:window .print();" value="Print Page" />
</div>
TO ALIGN IT CENTER:
<div id="ButtonDiv" style="text-align: center;">
<input type="button" name="PrintButton" onclick="javascript:window .print();" value="Print Page" />
</div>
TO ADD PADDING:
<div id="ButtonDiv" style="padding: 12px;">
<input type="button" name="PrintButton" onclick="javascript:window .print();" value="Print Page" />
</div>
Once it is inside the div, you can position it and stylize as needed.
If you want to add padding, or align it, put it inside of a div and add CSS styling.
For example...
TO ALIGN IT RIGHT:
<div id="ButtonDiv" style="text-align: right;">
<input type="button" name="PrintButton" onclick="javascript:window
</div>
TO ALIGN IT CENTER:
<div id="ButtonDiv" style="text-align: center;">
<input type="button" name="PrintButton" onclick="javascript:window
</div>
TO ADD PADDING:
<div id="ButtonDiv" style="padding: 12px;">
<input type="button" name="PrintButton" onclick="javascript:window
</div>
Once it is inside the div, you can position it and stylize as needed.
ASKER
mmarkbury,
I got it working the way I want it to work. Thank you.
I got it working the way I want it to work. Thank you.
ASKER