Since @Using (Html.BeginForm()) statement begins a form in "code block mode", in VB.NET context you need to set "text mode" either using @: (single line operator), @<text>...</text> (single or multiple line mode) or simply @ followed with HTML block element:
' Using @:
@Using (Html.BeginForm())
@:<table cellpadding="0" cellspacing="0" style="width: 800px; height:100px;">
<!-- inner table -->
@:</table>
End Using
' Using @<text>...</text>
@Using (Html.BeginForm())
@<text><table cellpadding="0" cellspacing="0" style="width: 800px; height:100px;">
<!-- inner table -->
</table></text>
End Using
'Using @<tag>...</tag>
@Using (Html.BeginForm())
@<table cellpadding="0" cellspacing="0" style="width: 800px; height:100px;">
<!-- inner table -->
</table>
End Using
The reason behind usage of operators to enclose HTML tags is that VB.NET allows inline XML elements by applying "text mode" inside "code block mode" which C# doesn't have that feature (see Razor syntax for VB.NET).
Hence, the provided sample in question should be modified like this, using @ before <tr> tag to create HTML block element under If code block:
@Using (Html.BeginForm())
@<table cellpadding="0" cellspacing="0" style="width: 800px; height:100px;">
@If ViewData("IsGroupVessel") Then
@<tr>
<td colspan="3">
@Html.DevExpress().Label(Sub(settings)
settings.AssociatedControlName = "GroupBooking"
settings.Text = "Maximum Exceeded"
End Sub).GetHtml()
</td>
</tr>
End If
</table>
End Using
As @Dai stated in his answer, I also prefers usage of a strongly-typed "view model" with properties instead passing ViewBag or ViewData, hence the modified code is shown below:
Model
Public Class ViewModel
Public Property IsExceeded As Boolean
' other models
End Class
Controller
Public Function ActionMethod() As ActionResult
Dim model As New ViewModel
' other logic
model.IsExceeded = True
' other logic
Return Me.View(model)
End Function
View
@ModelType ViewModel
@Using (Html.BeginForm())
@<table cellpadding="0" cellspacing="0" style="width: 800px; height:100px;">
@If Model.IsExceeded Then
@<tr>
<td colspan="3">
@Html.DevExpress().Label(Sub(settings)
settings.AssociatedControlName = "GroupBooking"
settings.Text = "Maximum Exceeded"
End Sub).GetHtml()
</td>
</tr>
End If
</table>
End Using
Related issues:
Razor View Engine Quirks in VB.NET
Using in Razor VB.net MVC not work as expected
Html.Labelis a "HTML Helper" which renders HTML directly in a stateless manner.End If, for starters.