在我的打印机包中。aspx文件我有以下“用户控制”:
<%@ Register Src="~/ProvisionControls/DeferredTaxRollforwardControl.ascx" TagPrefix="uc9" TagName="DeferredTaxesRollforwardControl" %>
...
...
<div>
<uc9:DeferredTaxesRollforwardControl ID="DeferredTaxesRollforwardControl1" runat="server" />
</div>
它调用控制文件'DeferredTaxRollforwardControl. ascx ' 包含我的表定义如下:
<table style="width: 4600px; border-spacing:0px;" border="0" frame="hsides" cellpadding="2" cellspacing="1">
<tr id = "tblTempDiff"> //want to import this
<td style="width:7.6%;" width="2px;" class="paintYellowTotalLeftBold">
Grand Total Current
</td>
<td style="width:2.8%;" width="2px;" class="paintYellowTotalBold">
<asp:Label ID="lblGrandTotalUnadjustedBeginningBalance" runat="server" Text=""></asp:Label>
</td>
... and more <td>
我正在尝试使用 PrinterPackage 中的以下代码显示表格并隐藏一些列。aspx.cs文件:
TableRow row = DeferredTaxesRollforwardControl1.FindControl("tblTempDiff") as TableRow;
row.Cells[0].Visible = true;
row.Cells[1].Visible = true;
row.Cells[2].Visible = true;
row.Cells[3].Visible = true;
row.Cells[4].Visible = true;
row.Cells[5].Visible = true;
row.Cells[6].Visible = true;
row.Cells[7].Visible = true;
row.Cells[8].Visible = true;
row.Cells[9].Visible = false;
row.Cells[10].Visible = false;
row.Cells[11].Visible = false;
row.Cells[12].Visible = false;
但是,这似乎没有拿起表格行tblTempDiff 而是给了我一个空值。如何将 TableRow tblTempDiff中的数据导入行,然后隐藏我想要隐藏的任何列?
如果您需要更多信息,请向我提问,因为我知道在解释我的问题时我不是最好的人。