Search code examples
transformationkentico

Kentico transformation textbox value in macro


I have a Kentico transformation with a text box and a button that fires a custom macro method that requires I pass the value in the text box. How can I access it using k#?

<input type="text" name="foo"/>
<asp:LinkButton runat="server" OnClick="<%# CustomMacroMethod(~foo.value~) %>" >Button</asp:LinkButton> 

Is there a way to access this value?


Solution

  • Best way to access this properly is to:

    1. create a custom static method,
    2. add a custom transformation method calling that custom static method,
    3. add the macro method calling that custom static method.

    This may seem like it's overkill but it allows you to use that same code throughout the site and the API.