Reputation: 6554
I am new to Razor view syntax and as most of the examples are in C# I need help in coverting the below Razor syntax to vb.net
<div>
@using (Html.BeginForm())
{
@Html.ValidationSummary()
<p>Your Name : @Html.TextBox("Name")</p>
<p>Your Age Range :
@Html.DropDownList("IsEligibleAge", new[] {
new SelectListItem() {Text = "Below 18", Value = bool.FalseString},
new SelectListItem() {Text = "18 and Above", Value = bool.TrueString}
}, "Please select your age")
</p>
<input type="submit" value="Submit Data" />
}
</div>
Upvotes: 1
Views: 4837
Reputation: 139808
I hope it works:
<div>
@using (Html.BeginForm())
@Html.ValidationSummary()
@<p>Your Name : @Html.TextBox("Name") </p>
@<p>Your Age Range :
@Html.DropDownList("IsEligibleAge", {
New SelectListItem() With {.Text = "Below 18", .Value = Boolean.FalseString},
New SelectListItem() With {.Text = "18 and Above", .Value = Boolean.TrueString}
}, "Please select your age")
</p>
@<input type="submit" value="Submit Data" />
end using
</div>
I used this good article about Razor and VB.NET for the translation.
Upvotes: 5