Save below code in html file and test..
Its Work perfect!!
<%@ Page Title="Home Page" Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs"
Inherits="_Default" %>
<html>
<head>
<style type="text/css">
#dv1, #dv2
{
font-size: 20px;
}
</style>
<style media="print">
.hidePrint
{
display: none;
}
</style>
<script type="text/javascript" language="javascript">
function fnSetStyle(Obj) {
if (Obj == 1) {
document.getElementById('dv1').className = '';
document.getElementById('dv2').className = 'hidePrint';
}
else {
document.getElementById('dv2').className = '';
document.getElementById('dv1').className = 'hidePrint';
}
}
</script>
<title></title>
</head>
<body>
<div id="dv1">
Portion 1: Place one portion here
</div>
<div id="dv2">
Portion 2: and another here..
</div>
Common portion: and click on Div1 to print first portion and click on Div2 to print another portion<br />
<input type="button" value="Div1" onclick="javascript:fnSetStyle(1);window.print();" />
<input type="button" value="Div2" onclick="javascript:fnSetStyle(2);window.print();" />
</body>
</html>