Common_MapTips_CSharp\CoincidentFeatureList.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 CoincidentFeatureList : System.Web.UI.Page { protected void Page_PreRender(object sender, System.EventArgs e) { // 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. string mapTipsInitJavaScript = @" function mapTipsInit() {{ window.setTimeout(""$find('{0}').add_coincidentFeaturesMouseOver(listAttributes);"", 1); }} Sys.Application.add_load(mapTipsInit);"; mapTipsInitJavaScript = string.Format(mapTipsInitJavaScript, 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(listAttributes);", MapTips1.GraphicsLayerClientID); ESRI.ArcGIS.ADF.Web.UI.WebControls.CallbackResult mapTipsInitCallbackResult = ESRI.ArcGIS.ADF.Web.UI.WebControls.CallbackResult.CreateJavaScript(mapTipsInitJavaScript); Map1.CallbackResults.Add(mapTipsInitCallbackResult); } } }