creating Html table dynamically including header in
(xhtml)
UI
<asp:TableRow ID="tdrCTC_CTCDetails_GrossIncomeAmt" runat="server" Width="794px">
<asp:TableCell Font-Size="XX-Small">
<table id="tblCTC_Data" runat="server">
<tr id="tdrCTCData_Header">
<td runat="server">Description fo Class Shares
</td>
<td runat="server">(a) Immediately before 1 January 2011
</td>
<td runat="server">(b) Where the company became a resident since 1 January 2011
</td>
</tr>
</table>
</asp:TableCell>
</asp:TableRow>
aspx page
tblCTC_Data.Rows.Clear();
HtmlTableRow headerRow = new HtmlTableRow();
headerRow.Cells.Add(new HtmlTableCell() { InnerText = "Description fo Class Shares" });
headerRow.Cells.Add(new HtmlTableCell() { InnerText = "(a) Immediately before 1 January 2011" });
headerRow.Cells.Add(new HtmlTableCell() { InnerText = "(b) Where the company became a resident since 1 January 2011" });
foreach (HtmlTableCell c in headerRow.Cells)
{
c.Style.Add("font-weight", "bold");
}
tblCTC_Data.Rows.Add(headerRow);
if (_rootCustomer.ReturnDetail.CorporateIncomeTaxReturn.CompanyDetails.ContributedTaxCapitalDetails.Count > 0)
{
//xData of type class //CorporateIncomeTaxReturnStructureCompanyDetailsContributedTaxCapitalDetail //variable
foreach (CorporateIncomeTaxReturnStructureCompanyDetailsContributedTaxCapitalDetail xDataTable in
_rootCustomer.ReturnDetail.CorporateIncomeTaxReturn.CompanyDetails.ContributedTaxCapitalDetails)
{
HtmlTableRow newRow = new HtmlTableRow();
newRow.Cells.Add(new HtmlTableCell() { InnerText = xDataTable.ShareClassDescription.ToString() });
newRow.Cells.Add(new HtmlTableCell() { InnerText = xDataTable.Before1January2011Amt.ToString() });
newRow.Cells.Add(new HtmlTableCell() { InnerText = xDataTable.Since1JanuaryAmt.ToString() });
}
}
(xhtml)
UI
<asp:TableRow ID="tdrCTC_CTCDetails_GrossIncomeAmt" runat="server" Width="794px">
<asp:TableCell Font-Size="XX-Small">
<table id="tblCTC_Data" runat="server">
<tr id="tdrCTCData_Header">
<td runat="server">Description fo Class Shares
</td>
<td runat="server">(a) Immediately before 1 January 2011
</td>
<td runat="server">(b) Where the company became a resident since 1 January 2011
</td>
</tr>
</table>
</asp:TableCell>
</asp:TableRow>
aspx page
tblCTC_Data.Rows.Clear();
HtmlTableRow headerRow = new HtmlTableRow();
headerRow.Cells.Add(new HtmlTableCell() { InnerText = "Description fo Class Shares" });
headerRow.Cells.Add(new HtmlTableCell() { InnerText = "(a) Immediately before 1 January 2011" });
headerRow.Cells.Add(new HtmlTableCell() { InnerText = "(b) Where the company became a resident since 1 January 2011" });
foreach (HtmlTableCell c in headerRow.Cells)
{
c.Style.Add("font-weight", "bold");
}
tblCTC_Data.Rows.Add(headerRow);
if (_rootCustomer.ReturnDetail.CorporateIncomeTaxReturn.CompanyDetails.ContributedTaxCapitalDetails.Count > 0)
{
//xData of type class //CorporateIncomeTaxReturnStructureCompanyDetailsContributedTaxCapitalDetail //variable
foreach (CorporateIncomeTaxReturnStructureCompanyDetailsContributedTaxCapitalDetail xDataTable in
_rootCustomer.ReturnDetail.CorporateIncomeTaxReturn.CompanyDetails.ContributedTaxCapitalDetails)
{
HtmlTableRow newRow = new HtmlTableRow();
newRow.Cells.Add(new HtmlTableCell() { InnerText = xDataTable.ShareClassDescription.ToString() });
newRow.Cells.Add(new HtmlTableCell() { InnerText = xDataTable.Before1January2011Amt.ToString() });
newRow.Cells.Add(new HtmlTableCell() { InnerText = xDataTable.Since1JanuaryAmt.ToString() });
}
}
No comments:
Post a Comment