且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在mvc4中将javascript数组分配给模型数组?

更新时间:2022-10-14 22:34:53

.each(


(' #ImageExtensionList选项:选中'),函数(索引,值){

selectedValues.push(value);



这里,@ Model .OptionList = selectedValues我想分配但不工作。



任何人都可以分享这个吗?



感谢。

Hi,

I have a javascript array and i want to assign all its value to MVC Model array.

For ex.

var selectedValues = [];
$.each($('#ImageExtensionList option:selected'), function (index, value) {
selectedValues.push(value);

here, @Model.OptionList = selectedValues i want to assign but not working.

Can anyone share on this?

Thanks.

.each(


('#ImageExtensionList option:selected'), function (index, value) {
selectedValues.push(value);

here, @Model.OptionList = selectedValues i want to assign but not working.

Can anyone share on this?

Thanks.