Unable to bind in asp.net grid Template Column

Posted by OneSmartGuy on Stack Overflow See other posts from Stack Overflow or by OneSmartGuy
Published on 2009-05-28T14:20:01Z Indexed on 2010/06/06 23:02 UTC
Read the original article Hit count: 247

Filed under:

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>

© Stack Overflow or respective owner

Related posts about ASP.NET