Common MapTips
Common_MapTips_VBNet\JavaScriptFormatting.aspx.vb
' Copyright 2011 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 JavaScriptFormatting
  Inherits System.Web.UI.Page
  Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
    ' 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>"
  End Sub
End Class