在gridview中每个单元格添加了onclick事件:protectedvoidGridView2_RowDataBound(objectsender,GridViewRowEventArgse){if(e.Row.RowType==DataControlRowType.DataRow){for(inti=0;... 在gridview中每个单元格添加了onclick事件:
protected void GridView2_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
for (int i = 0; i < e.Row.Cells.Count; i++)
{
e.Row.Cells[i].Attributes.Add("onclick", "ShowDetail("+i+")");
}
}
}
前台:
<script type="text/javascript">
function ShowDetail(status) {
alert(status)
}
</script>
总是提示JavaScript 运行时缺少对象,大神帮帮我,跪谢!
第一次点击不报错,但是第二次点击任意一个单元格就报错了。
展开
哈士奇WWW
相关分类