Ok This is probably a really stupid question, but I’ll ask him anyway ...
How can I use extensions and working methods in my ASP.Net markup? For example, (let's say) I have a DateTime extension method called "ToExampleString ()" (contained in the DateTimeExtensions class in my Common.Extensions project), and I want to use it in my markup in the ListView ItemTemplate:
<ItemTemplate> <span><%# ((DateTime)Eval("DateStarted")).ToExampleString() %></span> </ItemTemplate>
I get the following error:
"System.DateTime" does not contain a definition for "ToExampleString", and the extension method "ToExampleString" cannot be found that takes the first argument of type "System.DateTime" (do you miss the using directive or assembly references?)
The page simply cannot see the extension method.
Similarly, how can I make my page layout in a utility class:
<span><%# ExampleUtility.ProcessDate(Eval("DateStarted") %></span>
What steps should I take to get this stuff to work? I assume I'm missing something stupidly obvious?
thanks
Leigh bowers
source share