First as an aside, I sympathize with fellow
VB users. Too much is made by people who forget that a programming language is just a tool purchased to produce a product for a customer. Use the tool that suits you and does the job for you. As to my problem, when I added the code snippet to produce the check boxes:
Code:
<div class="form-group">
@Html.LabelFor(Function(model) model.Hobbies, htmlAttributes:= New With { .class = "control-label col-md-2"})
<div class="col-md-10">
@For Each hobby As String In hobbyList
' (note: I declared the checkedTest in the @Code section)
checkedText = If(Model.Hobbies.Contains(hobby), "checked", String.Empty)
<span>
<input name="hobbies" value="@hobby" type="checkbox" @checkedText />
@hobby
</span>
Next
</div>
</div>
both <span> and <input throw up an error stating
'Attributes cannot be applied to local variables'
Another thing I cannot resolve (remember that the title of this book starts with 'Beginning' is that 'model' doesn't get instantiated and retuns 'Nothing'.
I managed to sort out everything up to this point but I just cannot get around these. I use
VB and created the project as an MVC with ASP.
Any help?