2011-03-04 155 views
2

Visual Studio中提出,當我把HTML的@using塊內部的錯誤: 「expeted>」HTML在MVC 3剃鬚刀@using塊內

@Using (Ajax.BeginForm("UpdateForm", New AjaxOptions With {.UpdateTargetId = "textEntered"})) 
     @Html.TextBox("textBox1", "Enter text") 
     <br /> 
End Using 

我使用MVC 3,剃刀

作爲視圖引擎,並且VS2010表達。

我錯過了什麼?

感謝

UPDATE:答案在這裏Razor View Engine Quirks in VB.NET

回答

5

在VBHTML頁面,則需要直接與@前綴HTML代碼塊內(如您的@Using塊):

@Using (Ajax.BeginForm("UpdateForm", New AjaxOptions With {.UpdateTargetId = "textEntered"})) 
     @Html.TextBox("textBox1", "Enter text") 
     @<br /> 
End Using 
+0

我見。這太遺憾了。我唯一的選擇是使用不同的視圖引擎(例如aspx)? – 2011-03-04 22:29:11

+1

@Jamie:答案是cshtml – 2011-03-04 22:31:43

+1

@Matti我認爲這很荒謬,我們應該只在VB中使用@而不是C#來使用塊前綴。 – 2011-03-04 22:39:50