I have a Repeater that contains a Table. I want to hide the some tablecells of the table in repeater item template Here is the ASPX source code:
<ItemTemplate>
<table style="width: 100%" align="center">
<tr>
<td style="width: 60px;" align="center">
<img src="upload/companylogo/<%# Eval("companylogo") %>" />
</td>
<td align="left">
<asp:Label runat="server" CssClass="lblcname" ID="Label1" Text='<%# Eval("companyname") %>' /></td>
<td align="right">
<asp:Label runat="server" ID="Label2" Text='<%# Eval("city") %>' /></td>
</tr>
<tr>
<td runat="server" id="address" colspan="3">
<asp:Label runat="server" ID="Label3" Text='<%# Eval("address") %>' />
</td>
</tr>
<tr>
<td colspan="3" align="right" id="vp" runat="server">
<a href='nfonews.aspx?id=<%# Eval("mpid") %>'>view Profile</a>
» Send Inquiry </td>
</tr>
<tr>
<td colspan="3" style="height: 20px; background-image: url(image/stripe_head_bg.png)"></td>
</tr>
</table>
</ItemTemplate>
And my code-behind:
SqlDataReader dr = cmd.ExecuteReader();
if (dr.HasRows == true)
{
dr.Read();
if (dr["payment"].ToString() == "Yes")
{
Repeater1.DataBind();
if (Repeater1.Items.Count == 0)
{
Repeater1.Visible = false;
}
else
{
Repeater1.Visible = true;
}
}
}