I am an ASP.NET MVC 3 noob learning by working my way thru the wrox book–but translating the code to VB because I work in a VB shop.
I am trying to translate this C# code into VB to generate a view:
@using (Html.BeginForm(“Search”, “Home”, FormMethod.Get)) {
<input type=”text” name=”q” />
<input type=”submit” value=”Search” />
}
It seems like a fairly simple case of just replacing the braces, but I get the following errors from the compiler and can’t figure out why.
@Using (Html.BeginForm("Search", "Home", FormMethod.Get))
<input type="text" name="q" /> // '>' expected.
<input type="submit" value="Search"/> // '>' expected.
End Using
I’m sure this is a simple sytnax issue, but I don’t know the syntax yet. I’m also trying to understand HTML helpers and razor, so there is a lot of new stuff. Can someone explain!
You need to mark the beginning of the html markup inside code blocks like inside
Usingwith@or with<text>.@is for single line:<text>is for multi line:For more info see: Combining text, markup, and code in code blocks