I\'m not sure why this syntax complain error \"Enter is not declared. May be inaccessible due to protection level\" and must put \"@html(\" to get rid the error.
Thi
When you are inside a Using
block you are in "code mode" in Razor.
So you need to use the @:
(for single line statements) or @
(for multi line statements) to switch back to "text mode" and output html.
With using @:
:
@Using (Html.BeginForm("GetUser", "UserProfile", FormMethod.Post))
@:Enter User id :- @Html.TextBox("UserId",Model)
@:
End Using
or with using @
:
@Using (Html.BeginForm("GetUser", "UserProfile", FormMethod.Post))
@Enter User id :- @Html.TextBox("UserId",Model)
@
End Using
See also the Combining text, markup, and code in code blocks section for further info.