我以下的代码,是加在GridView的RowDataBound事件内的.在没有用MasterPage.master生成页中调试通过没有问题,可是这段代码如果是放在引用了MasterPage.master页的页面时,就会出错,请问是什么原因?该如何改?
If e.Row.RowType <> DataControlRowType.Pager Then
            e.Row.Cells(0).Attributes.Add("style", "display:none")
        End If
        Dim i As Integer
        If e.Row.RowType = DataControlRowType.DataRow Then
            e.Row.Attributes.Add("onclick", "this.cells(0).childNodes(0).click()")
            For i = 0 To GridView1.Columns.Count - 1
                If (GridView1.Columns(i) Is "CommandField") Or (GridView1.Columns(i) Is "ButtonField") Then
                    Continue For
                End If
                e.Row.Cells(i).Attributes.Add("onclick", "this.parentElement.cells(0).childNodes(0)")
            Next
        End If