GridView not showing HeaderText

G

Guest

I'm not sure why my GridView isn't showing the HeaderText 'Title' at the top
of my grid when rendered in my aspx:


<asp:GridView
ID="gvPodcasts"
runat="server"
AllowPaging="true"
PageSize="3"
AllowSorting="true"
AutoGenerateColumns = "False"
BackColor="#FFFCC5"
BorderColor="Tan"
BorderWidth="1px"
CellPadding="2"
ForeColor="#000000"
GridLines="None">
<Columns>

<asp:TemplateField>
<ItemTemplate>
<asp:HyperLink ID="hlTitle" HeaderText="Title"
runat="server" Text='<%#((Podcast)Container.DataItem).Title %>'
NavigateUrl='<%#((Podcast)Container.DataItem).URL %>'
SortExpression='<%#((Podcast)Container.DataItem).Title %>'/>
<br /><br />
<asp:Label ID="lblDescription" runat="server"
Text='<%#((Podcast)Container.DataItem).Description %>'></asp:Label>
<br /><br />
</ItemTemplate>
</asp:TemplateField>
</Columns>

<FooterStyle BackColor="#000000" />
<SelectedRowStyle BackColor="DarkSlateBlue" ForeColor="GhostWhite" />
<PagerStyle BackColor="PaleGoldenrod" ForeColor="DarkSlateBlue"
HorizontalAlign="Center" />
<HeaderStyle BackColor="#EFBA67" Font-Bold="True" />
<AlternatingRowStyle BackColor="#F8F8F7" />
 
G

Guest

Looking at this off the top of my head i think the headertext attribute needs
to by on the templatefield element not the itemtemplate element. Or you could
put in a header template.

Ciaran O'Donnell
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top