template-fields

When does a control in a programmatically added TemplateField have its' ID property set?

I have a TemplateField that is dynamically added to a custom GridView. void ITemplate.InstantiateIn(System.Web.UI.Control container) { switch (_templateType) { case ListItemType.Header: if (this.ParentGridView.ShowDeleteHeaderImage) { Image hImg = new I...

How do I set the Visible attribute in an ItemTemplate?

<asp:TemplateField HeaderText="Audio"> <ItemTemplate> <asp:Image ID="playImage" runat="server" ImageUrl="~/images/nextpg.gif" Visible='<%# (Eval("available")=="Y") ? true : false %>' /> </ItemTemplate> </asp:TemplateField> In my query I am returning the "available" column which is populated with ...