related: MVC3 Razor using Html.BeginForm problem
When I make an HTML form for MVC 3/VB with the Razor engine, I would expect to be able to do it like this:
@Using Html.BeginForm("Action", "Controller")
<fieldset>
@* Other form code and values *@
</fieldset>
End Using
But if I do that I get "BC32035: Attribute specifier is not a complete statement. Use a line continuation to apply the attribute to the following statement." I need to add an @ character before the opening tag to avoid this error. Can someone explain why?
When using Razor with C#, what you describe is possible, because parser can determine the transition from code to markup because of the explicit '<' characters in html is not a valid C# token. VB.NET supports inline XML directly in code, so the Razor parser cannot determine that you have transitioned back to markup, so you have to be more explicit.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With