MVC Macros on Page Type with long text

yago Auza asked on October 15, 2019 15:10

Hi, I am using kentico integrated with ASP.MVC. I currently have a page type which is composed of a long text field (rich text editor type.

The idea is to use a macro expression, which can be binded from the server side.

The idea would be to have something like that.


Or be able to replace the macro from the code using the document node.

When I enter the expression in the editor, the macro code changes and adds the following character @ {%Model.MyFild@%}

When I test the page,shows the following expresion.


Sometimes this does not happen. but when it does not occur it shows only the macro expression.

Is there a way to bind a macro expression and assign it a value from the server for a long text control?

Recent Answers

Juraj Ondrus answered on October 16, 2019 10:42

When using MVC development mode, you need to resolve the macros on your own. Macros were designed mainly for portal engine development mode. Right now, there is no logic which would parse the field values in the MVC code - so, you need to implement your own logic to parse the value and resolve macros. why don't you resolve the field value directly in the MVC code and add it to the rich text value in your MVC code? Resolving the macro would be just another code execution extra.
Also, the hash you see in the macro, is the macro security signature.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.