using System;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using System.Data;
using System.Configuration;
using System.Web.Security;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Telerik.Web.UI;
using System.Collections;

public partial class Default : System.Web.UI.Page 
{
    protected void Page_Load(object sender, EventArgs e)
    {
        RadDiagram1.DataSource = GetShapes();
        RadDiagram1.ConnectionDataSource = GetConnections();
        RadDiagram1.DataBind();
    }

    private IEnumerable GetShapes()
    {
        return new[] {
                new {id="Shape1", text="Shape 1", type="circle", x=100, y=300, width=300, height=100},
                new {id="Shape2", text="Shape 2", type="rectangle", x=200, y=100, width=200, height=200},
                new {id="Shape3", text="Shape 3", type="circle", x=300, y=300, width=300, height=100},
                new {id="Shape4", text="Shape 4", type="rectangle", x=400, y=100, width=200, height=200},
                new {id="Shape5", text="Shape 5", type="circle", x=500, y=300, width=300, height=100}
            };
    }

    private IEnumerable GetConnections()
    {
        return new[] {
                new {sourceShapeId="Shape2", sourceConnector="auto", targetShapeId="Shape1", targetConnector="auto", startCapField=Telerik.Web.UI.Diagram.ConnectionStartCap.FilledCircle,
                    endCapField=Telerik.Web.UI.Diagram.ConnectionEndCap.ArrowEnd},
                new {sourceShapeId="Shape2", sourceConnector="auto", targetShapeId="Shape3", targetConnector="auto", startCapField=Telerik.Web.UI.Diagram.ConnectionStartCap.FilledCircle,
                    endCapField=Telerik.Web.UI.Diagram.ConnectionEndCap.ArrowEnd},
                new {sourceShapeId="Shape4", sourceConnector="auto", targetShapeId="Shape5", targetConnector="auto", startCapField=Telerik.Web.UI.Diagram.ConnectionStartCap.FilledCircle,
                    endCapField=Telerik.Web.UI.Diagram.ConnectionEndCap.ArrowEnd}
            };
    }
}
