Unable to bind in asp.net grid Template Column
- by OneSmartGuy
I am having trouble accessing the data field. I receive the error: Databinding methods such as Eval(), XPath(), and Bind() can only be used in the context of a databound control.
I can get the value but using <%# getOpenJobs((string)Eval("ParentPart")) % but I need to use it in the if to display a certian picture if it passes the condition. Is there a better way to do this or am i just missing something simple?
<telerik:GridTemplateColumn UniqueName="hasOpenJobs" HeaderText="">
<ItemTemplate>
<% if (getOpenJobs((string)Eval("ParentPart")) > 1)
{ %>
<img src="../images/job-icon.gif" alt="Open Jobs" />
<%} %>
</ItemTemplate>
</telerik:GridTemplateColumn>