我有一个RowDataBound
事件,如下所示。
protected void GridLedger_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Attributes.Add("onMouseDown", "var str = document.getElementById('" + e.Row.ClientID + "').cells[0].innerText; document.getElementById('<%=TextBox1.ClientID%>').value = str;");
}
}
当此事件触发时,我收到以下错误:
object element not found or not an object
为什么我收到此错误?
答案 0 :(得分:0)
我建议你使用jQuery库或任何其他javascript框架,让你的生活更轻松。
在我看来,您无法找到您要查找的对象或属性单元格不存在。这甚至可能因浏览器而异......
查看生成的代码,看看该错误的ID是什么......