Search code examples
telerikblazorblazor-client-side

The name 'context' does not exist in the current context


Here's My code:

<TelerikGrid Data="@forecasts"
                 Sortable="true"
                 FilterMode="GridFilterMode.FilterMenu"
                 Resizable="true">
        <GridColumns>
            <GridColumn Title="Date">
                <template>
                    @{
                        var forecast = context as WeatherForecast;

                    }
                </template>
            </GridColumn>
        </GridColumns>
    </TelerikGrid>

What am I doing wrongenter image description here


Solution

  • This is one of those rare times when case matters in an HTML tag. Instead of:

    <template>
        @{
            var forecast = context as WeatherForecast;
        }
    </template>
    

    You need:

    <Template>
        @{
            var forecast = context as WeatherForecast;
        }
    </Template>