Common Custom EditorTask
Common_CustomEditorTask_CSharp\CustomEditorTask_CSharp\CustomEditor.cs
// Copyright 2007 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.
// 

using System;
using System.Collections.Generic;
using System.Text;
using ESRI.ArcGIS.ADF.ArcGISServer.Editor;

namespace CustomEditorTask_CSharp
{
    public class CustomEditor : Editor
    {
        public CustomEditor(CustomEditorTask task)
            : base(task){}

        public int PolylineLayerID
        {
            get
            {
                object o = Page.Session["polylineLyrID"];
                return o == null ? -1 : (int)o;
            }

            set
            {
                Page.Session["polylineLyrID"] = value;
            }
        }

        // Override to create and return custom EditExistingFeaturePanel
        protected override EditorPanel CreateEditExistingFeaturePanel(EditorTask task)
        {
            return new CustomEditExistingFeatureEditor(task);
        }

        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);

            if (MapResource != null && !Page.ClientScript.IsClientScriptBlockRegistered("display_editorSnapTip.js"))
            {
                // Register stylesheet for snap tip style.  Editor base class registers the explicit base class type when including
                // stylesheet.  As a result, classes that derive from the Editor must explicitly include stylesheet, if needed.
                string includeTemplate = "<link rel='stylesheet' text='text/css' href='{0}' />";
                string scriptLocation = Page.ClientScript.GetWebResourceUrl(typeof(CustomEditorTask), "CustomEditorTask_CSharp.styles.editorStyles.css");
                System.Web.UI.LiteralControl include = new System.Web.UI.LiteralControl(String.Format(includeTemplate, scriptLocation));
                ((System.Web.UI.HtmlControls.HtmlHead)Page.Header).Controls.Add(include);
            }
        }

    }
}