Converting C# Razor view syntax for checkboxlist into VB.Net

151 views Asked by At

Here is the HTML code for "CheckBoxListFor" which I copied from "http://www.codeproject.com/Articles/292050/CheckBoxList-For-a-missing-MVC-extension" Could you please help me out in converting this C# code into VB.Net?

@Html.CheckBoxListFor(model => model.PostedCities.CityIDs, 
                      model => model.AvailableCities, 
                      entity => entity.Id, 
                      entity => entity.Name, 
                      model => model.SelectedCities)
2

There are 2 answers

0
Vijay On BEST ANSWER
@Html.CheckBoxListFor(Function(model) model.PostedCities.CityIDs, _
                      Function(model) model.AvailableCities, _
                      Function(entity) entity.Id, _
                      Function(entity) entity.Name, _
                      Function(entity) If(Model.SelectedCities Is Nothing, False, Model.SelectedCities.Contains(entity.Id)),
htmlListInfo, Function(htmlAttribute) New With {.class = "chkBoxList"})
1
Keith On
@Html.CheckBoxListFor(Function(model) model.PostedCities.CityIDs, _
                      Function(model) model.AvailableCities, _
                      Function(entity) entity.Id, _
                      Function(entity) entity.Name, _
                      Function(model) model.SelectedCities)