Common MapTips
Common_MapTips_CSharp\CoincidentFeatureDropDown.aspx.cs
// 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.
// 

public partial class CoincidentFeatureDropDown : System.Web.UI.Page
{
    protected void Page_PreRender(object sender, System.EventArgs e)
    {
        // Construct JavaScript to call the MapTips initialization function.  
        string mapTipsInitJavaScript = @"
            function mapTipsInit() {{
                window.setTimeout(""initFeatureDropDownMapTips('{0}', '{1}');"", 500); 
            }}

            Sys.Application.add_load(mapTipsInit);";
        mapTipsInitJavaScript = string.Format(mapTipsInitJavaScript, Map1.ClientID, MapTips1.GraphicsLayerClientID);
        this.ClientScript.RegisterStartupScript(this.GetType(), "MapTipsInitialization",
            mapTipsInitJavaScript, true);
    }

    protected void Page_Load(object sender, System.EventArgs e)
    {
        Map1.ResourceRefreshed +=
            new ESRI.ArcGIS.ADF.Web.UI.WebControls.MapResourceRefreshedEventHandler(Map1_ResourceRefreshed);
    }

    void Map1_ResourceRefreshed(object sender, ESRI.ArcGIS.ADF.Web.UI.WebControls.ResourceRefreshedEventArgs args)
    {
        // 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")
        {
            string mapTipsInitJavaScript =
                string.Format("$find('{0}').add_coincidentFeaturesMouseOver(showFeatureDropDown);", MapTips1.GraphicsLayerClientID);
            ESRI.ArcGIS.ADF.Web.UI.WebControls.CallbackResult mapTipsInitCallbackResult = 
                ESRI.ArcGIS.ADF.Web.UI.WebControls.CallbackResult.CreateJavaScript(mapTipsInitJavaScript);
            Map1.CallbackResults.Add(mapTipsInitCallbackResult);
        }
    }
}