Q:

c# eval function

I have this code in a vb.net page and it works just fine.  When I tried to copy and paste the html into a c# page, it doesn't work, not sure why, any clue?
<asp:TemplateField HeaderText="Decal Expiration Date"                                                       SortExpression="ExpirationDate">
    <ItemTemplate>
        <%#DisplayExpirationDate(Eval("DecalID"))%>
    </ItemTemplate>
</asp:TemplateField>

the asp:Template field is in a gridview.  I have the function DisplayExpirationDate in the code behind.  On the aspx source page, it underlines the line <%#DisplayExpirationDate(Eval("DecalID"))%> and tells me that the best overloaded method match has some invalid arguments.  It works on the VB page, but not on the c# page.  
Any help, explanation appreciated.

A:

You have to cast your value to the appropriate data type, e.g. 
<%#DisplayExpirationDate((string)Eval("DecalID"))%> 

The method must accept an object of type object otherwise. In VB.NET it works as long as you compile without compiler option strict.

