Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/vb.net/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Vb.net 在带VB的MVC中使用CheckBoxFor时出错_Vb.net_Model View Controller_Checkboxfor - Fatal编程技术网

Vb.net 在带VB的MVC中使用CheckBoxFor时出错

Vb.net 在带VB的MVC中使用CheckBoxFor时出错,vb.net,model-view-controller,checkboxfor,Vb.net,Model View Controller,Checkboxfor,我正在尝试使用以下代码创建一个复选框: @Html.CheckBoxFor(Function(model) model.PotentialDishmachineProducts) @Html.ValidationMessageFor(Function(model) model.PotentialDishmachineProducts) 但是,它不断抛出错误: 模板只能与字段访问、属性访问、一维数组索引或单参数自定义索引器表达式一起使用 以下是模型中的属性: Public Property Po

我正在尝试使用以下代码创建一个复选框:

@Html.CheckBoxFor(Function(model) model.PotentialDishmachineProducts)
@Html.ValidationMessageFor(Function(model) model.PotentialDishmachineProducts)
但是,它不断抛出错误:

模板只能与字段访问、属性访问、一维数组索引或单参数自定义索引器表达式一起使用

以下是模型中的属性:

Public Property PotentialDishmachineProducts As String
它没有绑定到数据库或任何东西中。有没有办法让这个复选框起作用?顺便说一句,如果不是很明显的话,我是MVC和VB的新手


谢谢

转换为字符串
转换为
布尔值

解决了这个问题。将字符串转换为布尔值。您可以自己回答下面的问题,也可以完全删除该问题。