0
我有問題。我在ASPX頁面中有一個表格,我試圖讓我的打印功能起作用。我想在選擇一行時打印特定行,選擇當前行時打印整個表格。我能夠使選定的行工作。但是當不選擇行時,我無法打印整個表格。可以使用相同的打印按鈕來執行這兩種功能還是需要使用不同的按鈕?謝謝打印按鈕在ASPX頁面
function PrintPage() {
//var printContent = document.getElementById('<= SessionNotes.ClientID %>');
var printContent = document.getElementById('printsessionNote');
var printWindow = window.open("Selected Row", "Print Panel", 'left=50000,top=50000,width=0,height=0');
printWindow.document.write(printContent.innerHTML);
printWindow.document.close();
printWindow.focus();
printWindow.print();
return false;
}
function Divprint(category,date,starttime,endtime,totaltime,staff,note)
{
$('#lblDateval').html(date);
$('#lblCategoryval').html(category);
$('#lblstarttimeal').html(starttime);
$('#lblEndtimeal').html(endtime);
$('#lblTotaltimeal').html(totaltime);
$('#lblstaffphysicianal').html(staff);
$('#lblnote').html(note);
return false;
}
<asp:HiddenField ID="hdn_FromID" runat="server" Value="" />
<asp:HiddenField ID="hdn_ToId" runat="server" Value="" />
<div id="printsessionNote" runat="server">
<table style="width:100%">
<tr>
<td>Date</td>
<td>Category</td>
<td>Start Time</td>
<td>End Time</td>
<td>Total Time</td>
<td>Staf/Physician</td>
</tr>
<tr>
<td><label id="lblDateval"></label></td>
<td><label id="lblCategoryval"></label></td>
<td><label id="lblstarttimeal"></label></td>
<td><label id="lblEndtimeal"></label></td>
<td><label id="lblTotaltimeal"></label></td>
<td><label id="lblstaffphysicianal"></label></td>
</tr>
<tr>
<td colspan="6">
Note : <label id="lblnote"></label>
</td>
</tr>
</table>
</div>
<div>
<asp:Button ID="btnprintpatientlist" runat="server" Text="Print" OnClientClick=" javascript:return PrintPage();"
BackColor="#FFCB05" Width="100px" Height="30" BorderWidth="0" />
<asp:Button ID="btndownloadpdf" runat="server" Text="Download" BackColor="#FFCB05" Width="100px" Height="30" BorderWidth="0" OnClick="btnExport_Click"/>
</div>
<p hidden="hidden" class="ses-pls">Please Select the session note(s) to print or select 'Print' to 'Print all'</p>
</div>
你的代碼不工作的方式是什麼?您是否試圖解決打印問題,或者詢問是否有一個按鈕與兩個按鈕相比具有良好的用戶體驗?這是不是很清楚你從我們這裏要求什麼。 – David
嗨大衛。我試圖讓我的代碼在同一時間工作,我問是否有兩個功能具有相同按鈕的好方法。 – Vikee