Executing Methods with ItemTemplate Parameters in ASP.NET
Question
I need to execute a method within an ItemTemplate
in my DataList
. How do I format the method in the page to work correctly with an Eval
?
The method takes an int
as a parameter.
<%# NumberOfEmplyeeOrders(Int32.Parse("EmployeeID"))%>
Solution 2
I had a syntax error in my cast. Here is the correct code:
<%#NumberOfEmplyeeOrders((Int32)(Eval("EmployeeID"))) %>
OTHER TIPS
<%# NumberOfEmplyeeOrders((Int32)Eval("EmployeeID")) %>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow