views:

31

answers:

1

I've got a JQuery tabcontrol (4 tabs), which each of them control 1 gridview. now I got a button "print". It activates a javascriptfunction, which should build a page, containing all gridviews. I got something, but it does not work:

function doPrintPage() {

        myWindow = window.open('', '', 'titlebar=yes,menubar=yes,status=yes,scrollbars=yes,width=500,height=600');

        myWindow.document.open();

        myWindow.document.writeln("<link href='/styles/Layout.css' type='text/css' rel='stylesheet' ></link>");

        myWindow.document.write(document.getElementById('tabcontainer').innerHTML);

        myWindow.document.close();

        myWindow.focus();

        myWindow.print();

        return true;

    }

I thought it may be the getElementByID() and then something like 'tabcontainer' (which contains the tabs) or 'tabcontent' (the content of each tab) or 'GridView1' or something, but I could be completely wrong. As I ain't got a clue...

A: 

Solution:

function doPrintPage()
{

myWindow = window.open('', '', 'titlebar=yes,menubar=yes,status=yes,scrollbars=yes,width=800,height=600');

myWindow.document.open();
myWindow.document.write("</br>");
myWindow.document.write("<h2>Results</h2>");
myWindow.document.write(document.getElementById('tab1').innerHTML);
myWindow.document.write("</br>");
myWindow.document.write("<h2>Tree</h2>");
myWindow.document.write(document.getElementById('tab2').innerHTML);
myWindow.document.write("</br>");
myWindow.document.write("<h2>Open</h2>");
myWindow.document.write(document.getElementById('tab3').innerHTML);
myWindow.document.write("</br>");
myWindow.document.write("<h2>Free</h2>");
myWindow.document.write(document.getElementById('tab4').innerHTML);

myWindow.document.close();

myWindow.focus();

//myWindow.print();

//myWindow.close();

return true;

}

The seperate gridviews where embedded in div's ("tab#"), which where embedded in the tabcontainer. Simple solution... select the correct div ID... Apparantly I overlooked this one

Joris