Printing the contents of a Gridview
Dear All, I am using following JavaScript to print the Gridview. The Idea is to hide all the contents (except the Gridview) and then print the window. But the Probelem is that when I use it to print from a simple page it works fine. But when I try to use it in a page with master Page assigned to it. it gives error that object is required.
1. What might be the problem???
2. Is there any easy way to print the contents of a gridview??
The Javascript function is :
function PrintReport()
{
var tdTable0=document.getElementById("TableTop")
tdTable0.style.display = "none"
var tdTable1=document.getElementById("TableH1")
tdTable1.style.display = "none"
var tdTable2=document.getElementById("TableH2")
tdTable2.style.display = "none"
if (window.print)
{
window.print();
}
else
{
alert("your browser doesn't support this function")
}
var tdTable0=document.getElementById("TableTop")
tdTable0.style.display = ""
var tdTable1=document.getElementById("TableH1")
tdTable1.style.display = ""
var tdTable2=document.getElementById("TableH2")
tdTable2.style.display = ""
}
|