写了个Button的Click事件处理程序
```protected void bntLook_Click(object sender, EventArgs e)
{
Button btnLook = sender as Button;
GridViewRow gr = btnLook.Parent.Parent as GridViewRow;//这里报错
Response.Redirect("Information.aspx?labID = " + gr.Cells[1].ToString());
return;
}
这是怎么回事
bntLook和gr是null
我按照这上面写的http://www.cnblogs.com/jy02414216/archive/2012/08/10/2633086.html
未将对象引用设置到对象的实例
- 写回答
- 好问题 0 提建议
- 关注问题
- 邀请回答
-
1条回答 默认 最新
- 普通网友 2017-05-02 11:58关注
看看是不是这个对象有问题,加断点调试看看吧
btnLook.Parent.Parent本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报