Developer forum

Forum » Dynamicweb 10 » Helpers converted to functions DW10

Helpers converted to functions DW10

Vincent Gercke
Reply

I'm experiencing difficulties when converting helpers to functions as per the DW10 documentation:

I'm seeing this error when I try to call a converted helper in the template:

Line 788: Argument 1: cannot convert from 'void' to 'object'

The function in question:

I am calling the function in the template where I want to use it like so:
@RenderErhvervsTypeCheckboxes("blabla")

Am I missing something obvious? :-)


Replies

 
Theodor Perrier
Reply
This post has been marked as an answer

When calling functions inline, like the example given in the docs.
In later verisions of the Razor page engiene, it expects the function to return either a string or IHtmlContent.

The correct context for a void method in you need to wrap it in a code block instead, to allow corrext context @{ }

Votes for this answer: 1
 
Vincent Gercke
Reply

Thank you, Theodor! Much appreciated :-)

 

You must be logged in to post in the forum