1. Create a new ASP.NET MVC Application and add a DiagramView control to the page. Follow steps 1-4 from Tutorial 1: Getting started. Add a NodeListView control to the page:
C# Copy Code |
---|
@Html.NodeListView(((NodeListView)ViewBag.NodeListView), new { style = "width:300px;height:500px;" }) |
2. In the HomeController.cs file define a node template string that lists layout containers and graphics primitives from which nodes should be composed.
C# Copy Code |
---|
string template = @"{ |
3. Add a new OrgChartNode class to the project and implement it as below. Its instances will represent the custom nodes posted back fro client side. The AutoJson attribute generates automatic JSON serialization .NET code to transfer values of properties defined in the template.
C# Copy Code |
---|
using System; |
4. Switch back to HomeController.cs. Set up the DiagramView and NodeListView controls. Custom item types registry is stored in the session. Call RegisterItemType once to register the custom class, and RegisterSession method for any control that will use the custom item type.
C# Copy Code |
---|
DiagramView view = new DiagramView("diagramView1"); |
5. Initialize the diagram with some OrgChartNodes:
C# Copy Code |
---|
if (Request.HasFormContentType) |