gpt4 book ai didi

c# - 使用 C# 中的 2D 字符串数组填充 JavaScript 数组

转载 作者:行者123 更新时间:2023-11-28 09:09:27 25 4
gpt4 key购买 nike

我正在使用 aspx 和 C# 构建一些 Web 应用程序,我想在 java 脚本中创建一个 2D 字符串数组,但使用我的 c# 代码中的数组对其进行初始化。我使用了“<% ... %>”,但它不起作用。我的代码是这样的:

iconColors = new String[,];
protected void Page_Load(object sender, EventArgs e)
{ // some code that filling the array
}

在 Java 脚本中:

<script>
var seatColor = "<%= iconColors %>";
for (.... i and j....) {// its a double loop
document.write("....."+iconColos[i,j]+"...");
}
</script>

再说一次,它不起作用。帮助某人?

最佳答案

我想这一定有效。

<script>
var seatColor = "<%= iconColors %>";
for (.... i and j....) {// its a double loop
document.write("....."+seatColor [i][j]+"...");
}
</script>

关于c# - 使用 C# 中的 2D 字符串数组填充 JavaScript 数组,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16506644/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com