I have the following syntax in a .cshtml page:
@cell(<Class object>)
And is defined like this in the header:
Func<dynamic, object> cell =
@<........>;
How can I define the cell Func so that I can send it an int parameter, like this?
@cell(<Class object>, intNum)
Thanks
You have 2 ways:
first one, the clever way: make a class type that contains at least 2 properties, the original Class and the int number that you need. and then access them.
second one:
the proper way of razor delegate:
http://haacked.com/archive/2011/02/27/templated-razor-delegates.aspx
http://blogs.msdn.com/b/simonince/archive/2012/01/26/templated-razor-delegates-combined-with-partial-views.aspx
Use delegates is not necessary unless you need to pass html code to an htmlhelper extension.
Maybe you need to use a @helper function and conserve html inside a cshtml file.