using
문을 면도기 뷰에서 일반 메서드로 사용할 수있는 방법이 있습니까? 예를 들어 나는 HTML 태그 등의 면도기 해석 <Controller>
때문에, 웹 양식이 면도기보기의 일반 방법으로 사용
<% using(Html.BeginForm<Controller>(c => c.Method()))
{ %>
Some code
<% } %>
이
@using(Html.BeginForm<Controller>(c => c.Method()))
{
Some code
}
처럼 면도칼로 변환 니펫을하지만, 그래도 문제가 해결되지 싶습니다. 면도기는 BeginForm
을 시작하고 끝나는 중괄호를 포함하지 않으므로 괄호를 추가해도 작동하지 않습니다. 아래는 내가 시도한 여러 접근법들이다. 나는 더 이상 생각할 수 없다.
@using(Html.BeginForm<Controller>(c => c.Method())) // Interpreted as c# to '<Controller>'
{ // interpreted as HTML
Some code // interpreted as HTML
} // interpreted as HTML
@(using(Html.BeginForm<Controller>(c => c.Method()))) // Interpreted as c#
{ // interpreted as HTML
Some code // interpreted as HTML
} // interpreted as HTML
@{using(Html.BeginForm<Controller>(c => c.Method())) // Interpreted as c#
{ // interpreted as c#
Some code // interpreted as c#
} // interpreted as c#
} // interpreted as c#
@(using(Html.BeginForm<Controller>(c => c.Method()))) // Interpreted as c#
@{ // interpreted as c#
Some code // interpreted as c#
} // interpreted as c#
aynone이이를 수행하는 방법을 알고 있습니까?
업데이트 : 위의 세 번째 방법은 이렇게하는 방법입니다. 면도기는 분명히 다음과 같이 작동합니다.
일을하는 가장 분명한 방법은 아니지만 작동합니다.
업데이트 2 : 아마도 위의 옵션 # 1이 예상대로 작동하기 때문에 면도기가 아마도 어느 시점에서 업데이트되었을 것입니다.
@using(Html.BeginForm<Controller>(c => c.Method()))
{
Some code
}
내 마지막에는 잘 작동하는 것처럼 보입니다. 하지만 'BeginForm'이 없습니다 (테스트 할 빠른 도우미 메소드를 만들었습니다). 그래서 외부 라이브러리 나 다른 것을 사용하고 있습니까? Razor Syntax의 오류는 무엇입니까? –
Buildstarted
우리는 강력한 형식의 HTML 헬퍼가 포함 된 Microsoft.Web.Mvc.dll의 MvcContrib 확장을 사용하고 있습니다. 그 오류는 @ (Html.BeginForm (...)) 잘 작동하지만 @using (Html.BeginForm (...)) 않습니다 그리고 그것을 형식화 할 수있는 방법을 알아낼 수 없습니다. 작업. –