<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<link href="styles.css" rel="stylesheet" type="text/css" />
<script language="javascript" type="text/javascript">
function getPrint(print_area)
{
if(confirm("Are you sure, you want to print?"))
{
var printContent = document.getElementById(print_area);
var printWindow = window.open('', '', 'left=50000,top=50000,width=0,height=0');
printWindow.document.write('<link rel="stylesheet" type="text/css" href="styles.css" />');
printWindow.document.write(printContent.innerHTML);
printWindow.document.close();
printWindow.focus();
printWindow.print();
printWindow.close();
}
}
</script>
<%--<style type="text/css">
.myDiv
{
background-image: url(./img/booked.gif);
background-repeat:no-repeat;
}
</style>--%>
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div id="divSchool">
<asp:Panel runat="server" ID="pnldiv" CssClass="myDiv">
<asp:Label ID="lblroom" runat="server" Font-Bold="true" Text="print a div in asp.net"></asp:Label>
<asp:Image ID="Image1" runat="server" ImageUrl="~/img/Einstein_1_JPEG.jpg.jpg" Width="100px" />
</asp:Panel>
</div>
<asp:Button ID="ImageButton1" runat="server" Height="19px" Text="print" AlternateText="Print License"
ToolTip="Print" OnClientClick="getPrint('divSchool')" Visible="true" />
</form>
</body>
</html>
No comments:
Post a Comment