2010-04-28 8 views
0

각 1 gridview를 제어하는 ​​JQuery tabcontrol (4 탭)이 있습니다. 이제 "인쇄"버튼이 있습니다. 그것은 모든 gridviews를 포함하는 페이지를 작성해야 javascriptfunction을 활성화합니다. 내가 뭔가를 얻었으나, 그것은 작동하지 않습니다javascript tabcontrol의 내용을 인쇄하십시오 : Gridviews

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; 

    } 

내가 그것을 (탭을 포함) '있는 TabContainer'또는 'tabcontent'(각 탭의 내용) 또는 '같은 getElementByID() 다음 뭔가있을 수 있습니다 생각 GridView1 '또는 뭔가,하지만 완전히 잘못 될 수 있습니다. 내가 단서를 가지고하지 않는 한 ...

답변

0

해결 방법 :있는 TabContainer에 포함

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; 

} 

사업부의에 내장 된 별도의있는 GridViews ("탭 #"). 간단한 해결책 ... 정확한 div ID를 선택하십시오 ... Apparantly이 것을 간과했습니다

관련 문제