I am using html template for Email and i want to hide its one table at some condition by code behind, how can i do it, please suggest me. I am wondering how can i do it, i am not able to find any way, please suggest me any way to come out from this, thanks in advance. My code is :
if (File.Exists(appPath + "\\rptBookDetails.Template"))
{
FinalOutPut = File.ReadAllText(appPath + "\\rptBookDetails.Template");
FinalOutPut = FinalOutPut.Replace("{AccessionNo}", dsBookDetails.Tables[0].Rows[0]["AccessionNo"].ToString());
FinalOutPut = FinalOutPut.Replace("{Title}", dsBookDetails.Tables[0].Rows[0]["TITLE"].ToString());
FinalOutPut = FinalOutPut.Replace("{Edition}", dsBookDetails.Tables[0].Rows[0]["EDITION"].ToString());
FinalOutPut = FinalOutPut.Replace("{Volume}", dsBookDetails.Tables[0].Rows[0]["Volume"].ToString());
FinalOutPut = FinalOutPut.Replace("{Authors}", dsBookDetails.Tables[0].Rows[0]["Authors"].ToString());
FinalOutPut = FinalOutPut.Replace("{Pages}", dsBookDetails.Tables[0].Rows[0]["PAGES"].ToString());
FinalOutPut = FinalOutPut.Replace("{Publication}", dsBookDetails.Tables[0].Rows[0]["PUB_PLACE"].ToString());
FinalOutPut = FinalOutPut.Replace("{PublicationYear}", dsBookDetails.Tables[0].Rows[0]["YEAR_O_PUB"].ToString());
FinalOutPut = FinalOutPut.Replace("{Price}", dsBookDetails.Tables[0].Rows[0]["COST"].ToString());
FinalOutPut = FinalOutPut.Replace("{Supplier}", dsBookDetails.Tables[0].Rows[0]["AccessionNo"].ToString());
FinalOutPut = FinalOutPut.Replace("{BillNo}", dsBookDetails.Tables[0].Rows[0]["BILL_NO"].ToString());
FinalOutPut = FinalOutPut.Replace("{BillDate}", dsBookDetails.Tables[0].Rows[0]["DT_O_BILL"].ToString());
FinalOutPut = FinalOutPut.Replace("{Grant Source}", dsBookDetails.Tables[0].Rows[0]["GRANT_SR"].ToString());
}
What i want to do is, in case i dont have books detail in database then i dont want to show the table in HTML out put. please help me
<table width="84%" border="1" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="30%" align="left" valign="top">
Accession No.
</td>
<td width="2%">
:
</td>
<td width="68%" align="left" valign="top">
B10
</td>
</tr>
<tr>
<td align="left" valign="top">
Title
</td>
<td>
:
</td>
<td align="left" valign="top">
{Title}
</td>
</tr>
<tr>
<td align="left" valign="top">
Edition
</td>
<td>
:
</td>
<td align="left" valign="top">
{Edition}
</td>
</tr>
<tr>
<td align="left" valign="top">
Volume
</td>
<td>
:
</td>
<td align="left" valign="top">
{Volume}
</td>
</tr>
<tr>
<td align="left" valign="top">
Authors
</td>
<td>
:
</td>
<td align="left" valign="top">
{Authors}
</td>
</tr>
<tr>
<td align="left" valign="top">
Pages
</td>
<td>
:
</td>
<td align="left" valign="top">
{Pages}
</td>
</tr>
<tr>
<td align="left" valign="top">
</td>
<td>
</td>
<td align="left" valign="top">
</td>
</tr>
<tr>
<td align="left" valign="top">
Publication Place
</td>
<td>
:
</td>
<td align="left" valign="top">
{Publication}
</td>
</tr>
<tr>
<td align="left" valign="top">
Publication Year
</td>
<td>
:
</td>
<td align="left" valign="top">
{PublicationYear}
</td>
</tr>
<tr>
<td align="left" valign="top">
</td>
<td>
</td>
<td align="left" valign="top">
</td>
</tr>
<tr>
<td align="left" valign="top">
Price
</td>
<td>
:
</td>
<td align="left" valign="top">
{Price}
</td>
</tr>
<tr>
<td align="left" valign="top">
Source of Purchase
</td>
<td>
:
</td>
<td align="left" valign="top">
{Supplier}
</td>
</tr>
<tr>
<td align="left" valign="top">
Bill No.
</td>
<td>
:
</td>
<td align="left" valign="top">
{BillNo}
</td>
</tr>
<tr>
<td align="left" valign="top">
Bill Date
</td>
<td>
:
</td>
<td align="left" valign="top">
{BillDate}
</td>
</tr>
<tr>
<td align="left" valign="top">
Grant Source
</td>
<td>
:
</td>
<td align="left" valign="top">
{Grant Source}
</td>
</tr>
</table>
<table width="97%" id="tblHistry" border="1" align="center" cellpadding="2" cellspacing="0">
<tr>
<th>
Sr
</th>
<th>
Trans. Id
</th>
<th>
Borrower Id
</th>
<th>
Issue Date
</th>
<th>
Expected Return Date
</th>
<th>
Actual Return Date
</th>
<th>
Fine
</th>
<th>
Fine Status
</th>
<th>
Issue Remarks
</th>
<th>
Return Remarks
</th>
</tr>
{HistoryTable}
</table>
I want to Hide and Show tblHistry on condition, please help me.