Access global page variable in helper

asp.net-mvc-3, razor

Solution

You can simply add it as member to you page by using @functions declaration:

@functions
{
    private int i;
}

Problem

``` @{ int i = 0; } @helper Text() { <input type="text" name="Ans[@i].Text" /> } ``` `i` is not accessible in helper. How to access it?

Original source