将checkboxlist的C#Razor视图语法转换为VB.Net

时间:2014-11-13 10:55:53

标签: html-helper c#-to-vb.net

以下是我从“http://www.codeproject.com/Articles/292050/CheckBoxList-For-a-missing-MVC-extension”复制的“CheckBoxListFor”的HTML代码。您能否帮助我将这些C#代码转换为VB.Net?

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

2 个答案:

答案 0 :(得分:1)

@Html.CheckBoxListFor(Function(model) model.PostedCities.CityIDs, _
                      Function(model) model.AvailableCities, _
                      Function(entity) entity.Id, _
                      Function(entity) entity.Name, _
                      Function(model) model.SelectedCities)

答案 1 :(得分:1)

@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"})