can anyone tell me what code should i use to print when i click the button it'll automatically print the page? or any other suggestion?

Have you tried checking here?

Hope that helps :) Please remember to mark solved once your issue is resolved.

can you explain for me further..i cannot get it from there..

Ok, basically, what I'm finding when I look at print options for web applications is this...

1) It's not a code-behind process, it's a user-end process
2) It can be accomplished using JavaScript or other browser-level scripting

A simple method to invoke a 'print-screen' type scenario would be the JavaScript function of

window.print()

Which will call the page print function. Beyond that, if you want to add additional print functionality (page layout, etc) you would need to look into other JavaScript or possibly ActiveX controls of some sort to implement those functions.

Hope that helps :) Please remember to mark as solved once your issue is resolved.

P.s.: The above information was from the first non-advertising link in the search I posted to you earlier... Please try to perform basic research before asking others to do your work for you in the forums :twisted:

firest create java script

<script type="text/javascript">
function printfn()
{
	document.getElementById('1001a1').innerHTML='';
	if(document.getElementById('down-time')!=null)
		document.getElementById('down-time').style.display='none';	
		cancelfn()
	window.print();
}
function cancelfn()
{
	document.getElementById('1001a2').innerHTML='';
	if(document.getElementById('down-time')!=null)
		document.getElementById('down-time').style.display='none';	
}
</script>

than write code in aspx file like this ....

<td align="center" valign="top" ><span id="1001a1">To Print Click Heare <a href="PrintPage.aspx" onclick="javascript:printfn();">(Print)</a></span></td>
                        <td align="center" valign="top"><span id="1001a2">To Cancel Click Heare<a href="CancelthanGoToPage.aspx" onclick="javascript:cancelfn();">(Cancel)</a></span></td>

and enjoy it.....


OR

Download Sample

http://www.mediafire.com/file/217g50uv7cf2lf6/Print Page Simple Way.rar
Patel Rikin
patelriki13@gmail.com

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.