Common MapTips
Common_MapTips_CSharp\CustomFormat_Client.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 CustomFormat_Client : System.Web.UI.Page 
{
    protected void Page_Load(object sender, System.EventArgs e)
    {
        // JavaScript added to the page on application startup to call the client-side MapTips
        // format initialization method and pass it the MapTips GraphicsLayers' client ID.  We
        // place the call in a timeout to ensure that the script containing the function has
        // been loaded prior to the call.
        string setMapTipsWidthJavaScript = @"
            // Declare a function to call the initialization method.
            function initializeMapTipsFormat() {{
                window.setTimeout(""applyCustomMapTipsFormat('{0}');"", 0);
            }}            

            // Wire the function to fire during the AJAX client-side load event
            Sys.Application.add_load(initializeMapTipsFormat);";

        // Replace "{0}" with the MapTips GraphicsLayer's client-side ID.
        setMapTipsWidthJavaScript = string.Format(setMapTipsWidthJavaScript,
            MapTips1.GraphicsLayerClientID);

        // Register the code as a startup script
        Page.ClientScript.RegisterStartupScript(this.GetType(), "initMapTipsFormat",
            setMapTipsWidthJavaScript, true);
    }
}