Skip to content
This repository was archived by the owner on Dec 14, 2018. It is now read-only.
This repository was archived by the owner on Dec 14, 2018. It is now read-only.

Razor Pages Error with Section and TagHelpers  #6964

@RandyBuchholz

Description

@RandyBuchholz

Razor pages throws an error when working with sections.
PostData is class declared inside the backing cs file.

This works

<label asp-for="PostData.PostId"></label>
@section detailsSection {
}

Moving the TagHelp into a section produces and error.
A local or parameter named '__model' cannot be declared in this scope because that name is used in an enclosing local scope to define a local or parameter

@section detailsSection {
    <label asp-for="PostData.PostId"></label>
}

Moving it to a partial works

@section detailsSection {
    @Html.Partial("PostData", @Model.PostData)
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions