Common Custom EditorTask
Common_CustomEditorTask_VBNet\CustomEditorTask_VBNet\CustomEditor.vb
' 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.
' 

Imports Microsoft.VisualBasic
Imports System
Imports System.Collections.Generic
Imports System.Text
Imports ESRI.ArcGIS.ADF.ArcGISServer.Editor

Namespace CustomEditorTask_VBNet
  Public Class CustomEditor
    Inherits Editor
    Public Sub New(ByVal task As CustomEditorTask)
      MyBase.New(task)
    End Sub

    Public Property PolylineLayerID() As Integer
      Get
        Dim o As Object = Page.Session("polylineLyrID")
        If o Is Nothing Then
          Return -1
        Else
          Return CInt(Fix(o))
        End If
      End Get

      Set
        Page.Session("polylineLyrID") = Value
      End Set
    End Property

    ' Override to create and return custom EditExistingFeaturePanel
    Protected Overrides Function CreateEditExistingFeaturePanel(ByVal task As EditorTask) As EditorPanel
      Return New CustomEditExistingFeatureEditor(task)
    End Function

    Protected Overrides Sub OnPreRender(ByVal e As EventArgs)
      MyBase.OnPreRender(e)

      If Not MapResource Is Nothing AndAlso (Not Page.ClientScript.IsClientScriptBlockRegistered("display_editorSnapTip.js")) Then
        ' 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.
        Dim includeTemplate As String = "<link rel='stylesheet' text='text/css' href='{0}' />"
                Dim scriptLocation As String = Page.ClientScript.GetWebResourceUrl(GetType(CustomEditorTask), "editorStyles.css")
        Dim include As System.Web.UI.LiteralControl = New System.Web.UI.LiteralControl(String.Format(includeTemplate, scriptLocation))
        CType(Page.Header, System.Web.UI.HtmlControls.HtmlHead).Controls.Add(include)
      End If
    End Sub

  End Class
End Namespace