我想在javascript函数中访问C#.net数组.而且我在运行时在javascript中遇到问题. [英] I want to access C#.net array in javascript function. And I have problem in javascript at run time.

查看:59
本文介绍了我想在javascript函数中访问C#.net数组.而且我在运行时在javascript中遇到问题.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在javascript函数中访问C#.net数组.而且我在运行时遇到了JavaScript问题.

I want to access C#.net array in javascript function. And I have problem in javascript at run time.

protected void Page_Load(object sender, EventArgs e)
    {

      Page.ClientScript.RegisterArrayDeclaration("myarray",arr[images.Rows.Count-1].ToString());

}



此javascript函数中的错误未显示数组元素或数据.



error in this javascript function not show array elements or data.

<script language="JavaScript" type="text/javascript">
         for(var i=0;i<myarray.length;i++)>
         {
           
            alert(myarray[i]);
         }
           </script>

推荐答案

不,这行不通:尝试构建有效的javascript数组声明,而不是仅在数组的单个元素上调用ToString. br/>
查看 MSDN [
No, that won''t work: try building a valid javascript array declaration rather than just calling ToString on a single element of your array.

Look at the MSDN[^] documentation! The example should make it clear, if not, look at the string you generate and compare it to the one Microsoft do!


这篇关于我想在javascript函数中访问C#.net数组.而且我在运行时在javascript中遇到问题.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆