The (pseudo code) expression within the “Visible”-Tag of the TemplateField is what I like to achieve, any ideas?
I´d really love to do it declaratively. No OnRowCreated event handling, Cells[x], …
<asp:GridView ID="GridViewTest" runat="server" AutoGenerateColumns="false">
<Columns>
<asp:BoundField DataField="MyProperty" HeaderText="My Property" />
<asp:TemplateField Visible="<%# MyProperty == 'VisibleString' %>">
<ItemTemplate>
<asp:ImageButton ID="ImageButton1" runat="server" AlternateText="" ImageUrl="" OnClick="ImageButton1_Click" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
It was not possible to do that on the TemplateField column itself because it has no DataBinding support. I had to do it within the ImageButton. Now it works perfectly: