Common_MapTips_VBNet\CoincidentFeatureList.aspx.vb
' Copyright 2010 ESRI ' ' All rights reserved under the copyright laws of the United States ' and applicable international laws, treaties, and conventions. ' ' You may freely redistribute and use this sample code, with or ' without modification, provided you include the original copyright ' notice and use restrictions. ' ' See the use restrictions. ' Imports Microsoft.VisualBasic Imports System Partial Public Class CoincidentFeatureList Inherits System.Web.UI.Page Protected Sub Page_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) ' Construct JavaScript to add the function that will create coincident feature MapTips as ' a handler of the coincidentFeaturesMouseOver event. We put this call in a timeout to ' ensure that the script has loaded prior to the call. Dim mapTipsInitJavaScript As String = "" & ControlChars.CrLf & " function mapTipsInit() {{" & ControlChars.CrLf & " window.setTimeout(""$find('{0}').add_coincidentFeaturesMouseOver(listAttributes);"", 1);" & ControlChars.CrLf & " }}" & ControlChars.CrLf & ControlChars.CrLf & " Sys.Application.add_load(mapTipsInit);" mapTipsInitJavaScript = String.Format(mapTipsInitJavaScript, MapTips1.GraphicsLayerClientID) Me.ClientScript.RegisterStartupScript(Me.GetType(), "MapTipsInitialization", mapTipsInitJavaScript, True) End Sub Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) AddHandler Map1.ResourceRefreshed, AddressOf Map1_ResourceRefreshed End Sub Private Sub Map1_ResourceRefreshed(ByVal sender As Object, ByVal args As ESRI.ArcGIS.ADF.Web.UI.WebControls.ResourceRefreshedEventArgs) ' If the resource containing the MapTips is refreshed, the client-side graphicFeatureGroup is ' re-created. So we need to re-add the coincidentFeaturesMouseOver handler. If args.MapResource.Name = "ESRI ADF Layer Map Tips" Then Dim mapTipsInitJavaScript As String = String.Format("$find('{0}').add_coincidentFeaturesMouseOver(listAttributes);", MapTips1.GraphicsLayerClientID) Dim mapTipsInitCallbackResult As ESRI.ArcGIS.ADF.Web.UI.WebControls.CallbackResult = ESRI.ArcGIS.ADF.Web.UI.WebControls.CallbackResult.CreateJavaScript(mapTipsInitJavaScript) Map1.CallbackResults.Add(mapTipsInitCallbackResult) End If End Sub End Class