从模型获取数组到视图
在我的模型中,我有一个 int 对象和一个布尔数组:
public class mymodel
{
public int Round { get; set; }
public Boolean[] lstLabs { get; set; }
}
在我看来,我这样写:
<script type="text/javascript">
var objModel = {
Round:"@Model.Round",
lstLabs: "@Model.lstLabs"
};
</script>
我只得到 Round (int 对象)的值,但我无法获取数组,我只得到这个:lstLabs:System .Boolean[] ,我尝试过: lstLabs: @Model.lstLabs.slice()
但它不起作用,我得到了同样的东西......
任何人都可以帮助我?
提前致谢。
In my model I have one int object and a boolean array:
public class mymodel
{
public int Round { get; set; }
public Boolean[] lstLabs { get; set; }
}
In my view I write this :
<script type="text/javascript">
var objModel = {
Round:"@Model.Round",
lstLabs: "@Model.lstLabs"
};
</script>
I get only the value of Round (the int object) , but I can't get the array , I just get this : lstLabs : System.Boolean[] , I tried : lstLabs: @Model.lstLabs.slice()
but it didn't work , I got the same thing...
Can anyone help me ?
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您想要视图模型的所有属性:
或者如果您只想要一个子集:
If you want all properties of the view model:
or if you want only a subset: