New to Telerik UI for ASP.NET MVC? Download free 30-day trial

OrgChartBuilder

Methods

Editable(System.Boolean)

If set to false, the user will not be able to edit the data to which the OrgChart is bound. By default, editing is enabled.

Parameters

enabled - System.Boolean

Enables or disables the editable option.

Example


             @(Html.Kendo().OrgChart<EmployeeViewModel>()
                .Name("orgchart")
                .Editable(false)
            )

Editable(System.Action)

If set to false, the user will not be able to edit the data to which the OrgChart is bound. By default, editing is enabled.

Parameters

configurator - System.Action<OrgChartEditableSettingsBuilder>

The action that configures the editable.

Example


             @(Html.Kendo().OrgChart<EmployeeViewModel>()
                .Name("orgchart")
                .Editable(editable => editable.Destroy(false))
            )

GroupField(System.String)

Specifies the field the nodes should be grouped by. If any value is passed, the OrgChart uses its grouping rendering mode.

Parameters

value - System.String

The value that configures the groupfield.

Example


             @(Html.Kendo().OrgChart<EmployeeViewModel>()
                .Name("orgchart")
                .GroupField("Group")
            )

GroupHeaderTemplate(System.String)

Provides an option to customize the default template for the group label (using the field value and name by default).

Parameters

value - System.String

The value that configures the groupheadertemplate.

Example


             @(Html.Kendo().OrgChart<EmployeeViewModel>()
                .Name("orgchart")
                .GroupHeaderTemplate("#: field # - #: value #")
            )

GroupHeaderTemplateId(System.String)

Provides an option to customize the default template for the group label (using the field value and name by default).

Parameters

value - System.String

The id of the external Kendo UI template.

Example


             @(Html.Kendo().OrgChart<EmployeeViewModel>()
                .Name("orgchart")
                .GroupHeaderTemplateId("headerTemplate")
            )

GroupHeaderTemplateView(System.Web.Mvc.MvcHtmlString)

Provides an option to customize the default template for the group label (using the field value and name by default).

Parameters

value - System.Web.Mvc.MvcHtmlString

The Razor View that contains the template.

Example


             @(Html.Kendo().OrgChart<EmployeeViewModel>()
                .Name("orgchart")
                .GroupHeaderTemplateView(Html.Partial("HeaderTemplate"))
            )

GroupHeaderTemplateHandler(System.String)

Provides an option to customize the default template for the group label (using the field value and name by default).

Parameters

value - System.String

The JavaScript function that returns the template content.

Example


             @(Html.Kendo().OrgChart<EmployeeViewModel>()
                .Name("orgchart")
                .GroupHeaderTemplateHandler("headerTemplateHandler")
            )

GroupHeaderTemplate(Kendo.Mvc.UI.TemplateBuilder)

Provides an option to customize the default template for the group label (using the field value and name by default).

Parameters

template - TemplateBuilder<TModel>

A Template component that configures the groupheadertemplate.

Example


             @(Html.Kendo().OrgChart<EmployeeViewModel>()
                .Name("orgchart")
                .GroupHeaderTemplate(Html.Kendo().Template().AddHtml("<b>Employees</b>"))
            )

Messages(System.Action)

Provides configuration options for the messages present in the OrgChart widget.

Parameters

configurator - System.Action<OrgChartMessagesSettingsBuilder>

The action that configures the messages.

Example


             @(Html.Kendo().OrgChart<EmployeeViewModel>()
                .Name("orgchart")
                .Messages(m => m.Destroy("Remove"))
            )

Template(System.String)

Defines a node card template.

Parameters

value - System.String

The value that configures the template.

Example


             @(Html.Kendo().OrgChart<EmployeeViewModel>()
                .Name("orgchart")
                .Template("#: Name #")
            )

TemplateId(System.String)

Defines a node card template.

Parameters

value - System.String

The id of the external Kendo UI template.

Example


             @(Html.Kendo().OrgChart<EmployeeViewModel>()
                .Name("orgchart")
                .TemplateId("orgChartTemplate")
            )

TemplateView(System.Web.Mvc.MvcHtmlString)

Defines a node card template.

Parameters

value - System.Web.Mvc.MvcHtmlString

The Razor View that contains the template.

Example


             @(Html.Kendo().OrgChart<EmployeeViewModel>()
                .Name("orgchart")
                .TemplateView(Html.Partial("TemplatePartial"))
            )

TemplateHandler(System.String)

Defines a node card template.

Parameters

value - System.String

The name of the JavaScript function that returns the template content.

Example


             @(Html.Kendo().OrgChart<EmployeeViewModel>()
                .Name("orgchart")
                .TemplateHandler("templateHandler")
            )

Template(Kendo.Mvc.UI.TemplateBuilder)

Defines a node card template.

Parameters

template - TemplateBuilder<TModel>

A Template component that configures the template.

Example


             @(Html.Kendo().OrgChart<EmployeeViewModel>()
                .Name("orgchart")
                .Template(Html.Kendo().Template().AddHtml("<b>Employee</b>"))
            )

CardsColors(System.String[])

Defines the colors that will be shown in the cards.

Parameters

value - System.String[]

A collection of card colors.

Example


             @(Html.Kendo().OrgChart<EmployeeViewModel>()
                .Name("orgchart")
                .CardsColors(new string[] {"pink", "blue", "orange"})
            )

DataSource(System.Action)

Configures the DataSource that will render the OrgChart items.

Parameters

configurator - System.Action<OrgChartAjaxDataSourceBuilder>

The value that configures the datasource.

Example


             @(Html.Kendo().OrgChart<EmployeeViewModel>()
                .Name("orgchart")
                .DataSource(dataSource => dataSource
                    .Read(r => r.Action("Read", "Home"))
                )
            )

DataSource(System.String)

Sets an external DataSource instance as a DataSource of the OrgChart.

Parameters

dataSourceId - System.String

The id of the data source instance.

Example


            @(Html.Kendo().DataSource<EmployeeViewModel>()
                .Name("dataSource1")
                ...
              )
             @(Html.Kendo().OrgChart<EmployeeViewModel>()
                .Name("orgchart")
                .DataSource("dataSource1")
            )

BindTo(System.Collections.IEnumerable)

Binds the OrgChart to an IEnumerable collection.

Parameters

data - System.Collections.IEnumerable

The data collection.

Example


             @(Html.Kendo().OrgChart<EmployeeViewModel>()
                .Name("orgchart")
                .BindTo((IEnumerable)ViewData["Employees"])
            )

BindTo(System.Collections.Generic.IEnumerable)

Binds the OrgChart to an IEnumerable collection.

Parameters

data - System.Collections.Generic.IEnumerable<T>

The data collection.

Example


             @(Html.Kendo().OrgChart<EmployeeViewModel>()
                .Name("orgchart")
                .BindTo((IEnumerable<EmployeeViewModel>) ViewData["Employees"])
            )

Events(System.Action)

Configures the client-side events.

Parameters

configurator - System.Action<OrgChartEventBuilder>

The client events action.

Example


             @( Html.Kendo().OrgChart()
                        .Name("OrgChart")
                        .Events(events => events
                            .Cancel("onCancel")
                        )
            )

ToComponent()

Returns the internal view component.

Name(System.String)

Sets the name of the component.

Parameters

componentName - System.String

The name of the component.

Example


            @(Html.Kendo().Grid<OrderViewModel>()
               .Name("grid")
               .Columns(columns =>
               {
                   columns.Bound(p => p.OrderID).Filterable(false);
                   columns.Bound(p => p.Freight);  
               })
               .DataSource(dataSource => dataSource
                   .Ajax()
                   .PageSize(20)
                   .Read(read => read.Action("Orders_Read", "Grid"))
               )
            )

Deferred(System.Boolean)

Suppress initialization script rendering. Note that this options should be used in conjunction with Kendo.Mvc.UI.Fluent.WidgetFactory.DeferredScripts(System.Boolean)

Parameters

deferred - System.Boolean

ModelMetadata(System.Web.Mvc.ModelMetadata)

Uses the Metadata of the Model.

Parameters

modelMetadata - System.Web.Mvc.ModelMetadata

The metadata set for the Model

HtmlAttributes(System.Object)

Sets the HTML attributes.

Parameters

attributes - System.Object

The HTML attributes.

HtmlAttributes(System.Collections.Generic.IDictionary)

Parameters

attributes - System.Collections.Generic.IDictionary<String,Object>

AsChildComponent()

Render()

Renders the component.

Example


            @(@Page Inherits="System.Web.Mvc.ViewPage<IEnumerable<Product>>" )
            @( Html.Kendo().Grid(Model)
                .Name("grid")
                .DetailTemplate(product => {
                    )
                       Product Details:
                       <div>Product Name: @( product.ProductName )</div>
                       <div>Units In Stock: @( product.UnitsInStock )</div>
                    @(
                })
                .Render();
            )

ToHtmlString()

ToClientTemplate()

In this article
Not finding the help you need?