Html.BeginForm에서 일부 HTML을 래핑하는 조건부 논리
@using(Html.BeginForm(MVC.Account.Info()))
{
<p>blah blah blah</p>
<input type="submit" value="Submit!" />
}
이제는 폼을 렌더링하고 제출해야합니다. User.Identity.IsAuthenticated
들여 쓰기 레벨이 중요한 경우이
@if(User.Identity.IsAuthenticated) // wraps the using and its open brace
{
@using(Html.BeginForm(MVC.Account.Info()))
{
}
<p>blah blah blah</p>
@if(User.Identity.IsAuthenticated) // wraps the input and the using closing brace
{
<input type="submit" value="Submit!" />
}
}
물론이 구문은 작동하지 않습니다. 누구든지이 일을하는 좋은 방법을 알고 있습니까?