C#后台想添加一些事件,将从数据库读取出来的数值赋给fn[i]然后循环给前台ImgPhoto添加事件,可是每次只能显示第一个。代码如下:
string[] fn = new string[dt.Rows.Count];//创建一个与表行数相等的固定数组
for (int i = 0; i < dt.Rows.Count; i++)
{
fn[i] = dt.Rows[i][1].ToString();
this.ImgPhoto.Attributes.Add("onmouseover", "javascript:photoTag.show("+fn[i]+")");
}希望大家给与帮助!
string[] fn = new string[dt.Rows.Count];//创建一个与表行数相等的固定数组
for (int i = 0; i < dt.Rows.Count; i++)
{
fn[i] = dt.Rows[i][1].ToString();
this.ImgPhoto.Attributes.Add("onmouseover", "javascript:photoTag.show("+fn[i]+")");
}希望大家给与帮助!
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货