Common MapTips
Common_MapTips_VBNet\CoincidentFeatureDropDown.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 CoincidentFeatureDropDown
  Inherits System.Web.UI.Page
  Protected Sub Page_PreRender(ByVal sender As Object, ByVal e As System.EventArgs)
    ' Construct JavaScript to call the MapTips initialization function.  
        Dim mapTipsInitJavaScript As String = "" & ControlChars.CrLf & "            function mapTipsInit() {{" & ControlChars.CrLf & "                window.setTimeout(""initFeatureDropDownMapTips('{0}', '{1}');"", 500); " & ControlChars.CrLf & "            }}" & ControlChars.CrLf & ControlChars.CrLf & "            Sys.Application.add_load(mapTipsInit);"
    mapTipsInitJavaScript = String.Format(mapTipsInitJavaScript, Map1.ClientID, 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(showFeatureDropDown);", 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