页面上网格数据绑定。根据行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
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
解决方案 »
- 路过的,帮看下
- 这样自动获取值怎么获得???
- DropDownList的第一个选项值的问题
- 网站做了服务器迁移后FreeTextBox提交的图片都不能显示了...
- *︻$▅▆▇◤ 捉拿高手!关于ASP.Net服务器硬盘Raid1的疑问
- gridview的问题
- textbox输入格式问题,希望得到帮助
- asp.net写的程序能不能像asp一样可以方便地在access和sqlserver间选择数据库?
- 如何获得整个项目的根目录的路径?
- 初学,给看看执行结果怎么会这样?
- cookie iframe 域的问题
- 200分高手帮忙,求正则表达式匹配html的<td class="list"></td>之间的内容?
建议,先写个JS函数,绑定事件中若用到,则直接传参数就好了