在gridview的DataBound数据绑定时,在其中一列添加图片并且添加一个jquery方法,具体如下:
e.Row.Cells[1].Text = "<img src=\'Images/add.png\' style=\'border: dashed 0 red; width: 20;height: 20;\' onclick=\"ExpandBelow(\'" + strValue + "\',\'" + strText + "\')\" />" + e.Row.Cells[1].Text;但是在jquery方法ExpandBelow()中无法通过$(this).attr("src") 获取不到图片的地址,请大家指点下该如何获取图片地址,谢谢

解决方案 »

  1.   

    onclick=\"ExpandBelow(\'" + strValue + "\',\'" + strText + "\')\" />"中strValue变量和strText 是什么?直接改成这样你看可以不可以
    onclick = "ExpandBelow(this)"
      

  2.   

    唉。你从浏览器上查看html源代码,能够看到这个东东么?
      

  3.   

    Chrome里面F12, 看看element是不是对,并且跟踪下js
      

  4.   

    html代码里面可以看到img对象,也有src属性,但是通过jquery无法取得