注册的JS方法没有了。怎么解决?急。真急!!!!高手进!!!

dljinsui 2006-06-29 10:57:52


页面上网格数据绑定。

根据行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
...全文
55 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
huangkc 2006-06-29
  • 打赏
  • 举报
回复
1\动态生成的JS,在服务器端事件发生后,很可能丢失
建议,先写个JS函数,绑定事件中若用到,则直接传参数就好了

zhf777 2006-06-29
  • 打赏
  • 举报
回复
你点的按钮是不是提交了页面并重新绑定了DataGrid?

62,073

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧