Back to Devexpress

DiagramBuilder.ID(JS) Method

aspnetcore-devextreme-dot-aspnet-dot-mvc-dot-builders-dot-diagrambuilder-dot-id-x28-devextreme-dot-aspnet-dot-mvc-dot-js-x29.md

latest1.9 KB
Original Source

DiagramBuilder.ID(JS) Method

Specifies the id attribute for the control’s HTML element (used for nested controls within templates).

Namespace : DevExtreme.AspNet.Mvc.Builders

Assembly : DevExtreme.AspNet.Core.dll

Declaration

csharp
public DiagramBuilder ID(
    JS expr
)

Parameters

NameTypeDescription
exprJS

A JavaScript expression that specifies the id attribute value.

|

Returns

TypeDescription
DiagramBuilder

A reference to this instance after the method is called.

|

Remarks

Use this method when you nest the Diagram control within a template. The method allows you to specify the id attribute for the control’s HTML element. To do this, use the new JS() expression. Refer to ID Option: Nested Controls in Templates for more information.

csharp
@using(Html.DevExtreme().NamedTemplate("myTemplate")) {
    @(Html.DevExtreme().Diagram()
        .ID(new JS("'diagram_' + ID"))
    )
}

After you specify the id attribute, you can use it to access the control’s JavaScript API at runtime (for example, to call methods).

See Also

DiagramBuilder Class

DiagramBuilder Members

DevExtreme.AspNet.Mvc.Builders Namespace