Say I have this repeater that uses the public Test function in code.
<asp:Repeater ID="Repeater1" runat="server">
<HeaderTemplate>
<table>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td><%# Eval("MyCol1")%></td>
<td><%# Eval("MyCol2")%></td>
<td><%# Test((int)Eval("MyCol1"))%></td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>
In my code, I have this function
public string Test (int Value)
{
return "Test"+Value.ToString();
}
This works great, but on my site I will have similar repeaters on different pages, and most of them will need to call the testing function. Instead of having it in the code for each web page, is it possible to put it in an open static class and call it directly from the relay? Something like this (which doesn't work):
<td><%# MyStaticClass.Test((int)Eval("MyCol1"))%></td>
The only solution I came across was to change the function in the code to:
public string Test (int Value)
{
return MyStaticClass.Test(Value);
}
But that would be more accurate if I didn’t have to put the code in the code for each web page (i.e. I would prefer the relay to call the static function directly).
?