页面上网格数据绑定。根据行index,自动生成JS方法但界面上还有一个按钮。点一下按钮,这些JS都没有了。导致再单击网格的链接按钮列就报错!!!!!!!!!如何解决。高手相助!!!    Private Sub dagr_ShowData_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles dagr_ShowData.ItemDataBound
        Dim CQuoteItem As New BLL.Quote.CQuoteItem
        If e.Item.ItemIndex <> -1 Then
            e.Item.Style.Add("CURSOR", " hand")
            e.Item.Attributes.Add("OnMouseOver", "currentcolor=this.style.backgroundColor;this.style.backgroundColor='#C0C0FF'")
            e.Item.Attributes.Add("OnMouseOut", "this.style.backgroundColor=currentcolor")
            e.Item.Cells(2).Text = CQuoteItem.StatTrans(BLL.Base.StatType.ValueToText, e.Item.Cells(2).Text)
            If (Not IsClientScriptBlockRegistered("QuoteItemGridclientScript" & e.Item.ItemIndex)) Then
                Dim strScript As String = "<script>" + vbCrLf
                strScript += "function QuoteItemGrid" & e.Item.ItemIndex & "(){" + vbCrLf
                strScript += "var str=window.showModalDialog('quoteItem.aspx?frmQuote_num=" & Trim(txt_Quotenum.Text) + "&frmQuote_line=" + e.Item.Cells(1).Text + "&frmCust_num=" & Trim(txt_Custnum.Text) & "&frmTax_code=" & Trim(txt_Tax.Text) & "',window,'dialogHeight: 600px;dialogWidth: 780px;dialogTop:160px;dialogLeft:120px; help: Yes; status: No;return(true);')" + vbCrLf
                strScript += "if(str!=null) window.location.reload();" + vbCrLf
                strScript += "}" + vbCrLf
                strScript += "</script>" + vbCrLf
                RegisterClientScriptBlock("QuoteItemGridclientScript" & e.Item.ItemIndex, strScript)
            End If
            e.Item.Attributes.Add("onclick", "QuoteItemGrid" & e.Item.ItemIndex & "()")
        End If
    End Sub