How do I hide a particular column in Asp Repeater ? I want to hide POwner in this case !
<ItemTemplate>
<tr>
<td>
<%#Eval("Priority") %>
</td>
<td>
<%#Eval("ProjectName") %>
</td>
<td>
<asp:Label ID="Label1" runat="server" Text='<%# Eval("POwner") %>'></asp:Label>
</tr>
</ItemTemplate>
Adding this in code behind gives an error :s
public void Repeater1_ItemDatabound(Object Sender, RepeaterItemEventArgs e)
{
Repeater a =(Repeater)e.Item.FindControl("Label1");
a.Visible = false;
}
Label1is aLabelcontrol and notRepeater, that’s why you’re getting an errorYou also need to add an
ifcondition so you only get theLabel1for items and not for header or footer.Try with this