Here is the javscript code to do this task
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="Form1" method="post" runat="server">
<div id="Div1" style="background-color:Silver; border:2px; height:200px; width:500px; border:2px; border-color:Red; border-style:solid">
Printable content
</div><script type="text/javascript">
<!–
function printPartOfPage(elementId)
{
var printContent = document.getElementById(elementId);
var windowUrl = ‘about:blank’;
var uniqueName = new Date();
var windowName = ‘Print’ + uniqueName.getTime();
var printWindow = window.open(windowUrl, windowName, ‘left=5000,top=5000,width=0,height=0’);printWindow.document.write(printContent.innerHTML);
printWindow.document.close();
printWindow.focus();
printWindow.print();
printWindow.close();
}
// –>
</script><asp:Button ID="Button1" runat="server" Text="Print" onclientClick="JavaScript:printPartOfPage(‘Div1’);" />
</form>
</body>
</html>