Common_MapTips_CSharp\JavaScriptFormatting.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 JavaScriptFormatting : System.Web.UI.Page { protected void Page_Load(object sender, System.EventArgs e) { // Here we specify the MapTips content to contain two rows. The first displays the value of the // POP2000 field divided by that of the AREA field and rounded to the nearest tenth. We can // perform dynamic calculation by including JavaScript inside a call to eval which in turn is // inside double curly braces, i.e. {{eval(<custom JavaScript here>)}}. The second row shows // the value of the POP00_SQMI field, which should match the value calculated in the first row. MapTips1.LayerFormat.Contents = "<table cellpadding='3px'><tr>" + "<td style='background-color:yellow; font-weight:bold;'>POP2000/AREA (Calculated)</td>" + "<td>{{eval(Math.round({POP2000}/{AREA} * 10) / 10;)}}</td></tr>" + "<tr><td style='background-color:yellow; font-weight:bold;'>POP00_SQMI (Database)</td>" + "<td>{POP00_SQMI}</td></tr></table>"; } }