Common Task results
Common_TaskResults_VBNet\TaskResultsWebSite\SimpleResult.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
Public Partial Class SimpleResult
  Inherits System.Web.UI.Page
  Protected Sub Toolbar1_CommandClick(ByVal sender As Object, ByVal toolbarCommandClickEventArgs As ESRI.ArcGIS.ADF.Web.UI.WebControls.ToolbarCommandClickEventArgs)
    ' Check to make sure our custom command was clicked.  This is not necessary in this case since there 
    ' is only one item on the toolbar, but is included here for demonstration.
    Select Case toolbarCommandClickEventArgs.CommandName
      Case ("CreateSimpleResult")
        ' Create a parent node and assign it a remove-only context menu
        Dim headingTaskResultNode As ESRI.ArcGIS.ADF.Web.UI.WebControls.TaskResultNode = New ESRI.ArcGIS.ADF.Web.UI.WebControls.TaskResultNode("Heading")
        TaskResults1.SetupContextMenu(TaskResults1.RemoveOnlyContextMenu, headingTaskResultNode)

        ' Create a child node and assign it a remove-only context menu
        Dim detailTreeViewPlusNode As ESRI.ArcGIS.ADF.Web.UI.WebControls.TreeViewPlusNode = New ESRI.ArcGIS.ADF.Web.UI.WebControls.TreeViewPlusNode("Detail")
        TaskResults1.SetupContextMenu(TaskResults1.RemoveOnlyContextMenu, detailTreeViewPlusNode)

        ' Add the child node to the parent and call EnsureVisible to make sure the parent node
        ' is not collapsed.  Note that EnsureVisible must be called after the node is added.
        headingTaskResultNode.Nodes.Add(detailTreeViewPlusNode)
        detailTreeViewPlusNode.EnsureVisible()

        ' Display the custom node by passing it to DisplayResults
        TaskResults1.DisplayResults(Nothing, Nothing, Nothing, headingTaskResultNode)

        ' Copy the TaskResults control's callback results to the Toolbar so they are processed
        ' on the client
        Toolbar1.CallbackResults.CopyFrom(TaskResults1.CallbackResults)
    End Select
  End Sub
End Class