2
Answers

How to work with print option in javascript

Couldn't get the value using javascript...prtMenu got the value ... but at print window its showing undefined(alert('prtMenu') is working fine displaying the value)... What would be the error?? 
 
<script type="text/javascript">
function PrintGridData() {
var prtGrid = document.getElementById('<%=searchedgrid.ClientID %>');
var prtMenu = document.getElementById("<%=lblCurrentPath.ClientID %>").innerHTML;
var prtwin = window.open('', 'PrintGridView', 'left=100,top=100,width=400,height=400,tollbar=0,scrollbars=1,status=0,resizable=1');
if (prtMenu != null) {
prtwin.document.write(prtMenu.outerHTML);
}
if (prtGrid != null) {
prtwin.document.write(prtGrid.outerHTML);
}
prtwin.document.close();
prtwin.focus();
prtwin.print();
prtwin.close();
}
</script>
Answers (2)