Databinding expressions are only supported on objects that have a

G

Guest

In my GridView I have this:

<Columns>
<asp:TemplateField HeaderText="Title"
SortExpression='<%#((Podcast)Container.DataItem).Title %>'>
<ItemTemplate>
<asp:Image ID="Image1"
ImageUrl="~/images/interact/icon_podcast.gif" runat="server" />
<asp:HyperLink ID="Title" runat="server"
Text='<%#((Podcast)Container.DataItem).Title %>'
NavigateUrl='<%#((Podcast)Container.DataItem).URL %>' />
<br /><br />
<asp:Label ID="Description" runat="server"
Text='<%#((Podcast)Container.DataItem).Description %>'></asp:Label>
<br /><br />
</ItemTemplate>
</asp:TemplateField>
</Columns>

I get this error that's been driving me nuts all afternoon, what a waste of
time:

Parser Error
Description: An error occurred during the parsing of a resource required to
service this request. Please review the following specific parse error
details and modify your source file appropriately.

Parser Error Message: Databinding expressions are only supported on objects
that have a DataBinding event. System.Web.UI.WebControls.TemplateField does
not have a DataBinding event.

Source Error:


Line 30:
Line 31: <Columns>
Line 32: <asp:TemplateField HeaderText="Title"
SortExpression='<%#((Podcast)Container.DataItem).Title %>'>
Line 33: <ItemTemplate>
Line 34: <asp:Image ID="Image1"
 

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