New to Telerik UI for ASP.NET Core? Start a free 30-day trial

Defines the fluent API for configuring the Kendo UI ContextMenu for ASP.NET MVC events.

Definition

Constructors

Initializes a new instance of the ContextMenuEventBuilder class.

C#
public ContextMenuEventBuilder(IDictionary<string, object> events)
Parameters:eventsIDictionary<string, object>

The ContextMenu event handlers.

Methods

Defines the handler of the Activate client-side event. Fires when a sub menu or the ContextMenu gets opened and its animation finished.

C#
public ContextMenuEventBuilder Activate(Func<object, object> handler)
Parameters:handlerFunc<object, object>

The handler code wrapped in a text tag.

Returns:

ContextMenuEventBuilder

Returns the current instance of ContextMenuEventBuilder .

Example:
C#
@( Html.Kendo().ContextMenu()
.Name("ContextMenu")
.Events(events =&gt; events.Activate(
@&lt;text&gt;
function(e) {
//event handling code
}
&lt;/text&gt;
))
)

Defines the handler of the Activate client-side event. Fires when a sub menu or the ContextMenu gets opened and its animation finished.

C#
public ContextMenuEventBuilder Activate(string handler)
Parameters:handlerstring

The name of the JavaScript function that will handle the Activate event.

Returns:

ContextMenuEventBuilder

Returns the current instance of ContextMenuEventBuilder .

Example:
C#
@( Html.Kendo().ContextMenu()
.Name("ContextMenu")
.Events(events =&gt; events.Activate("onActivate"))
)

Defines the handler of the Close client-side event. Fires before a sub menu or the ContextMenu gets closed. You can cancel this event to prevent closure.

C#
public ContextMenuEventBuilder Close(Func<object, object> handler)
Parameters:handlerFunc<object, object>

The handler code wrapped in a text tag.

Returns:

ContextMenuEventBuilder

Returns the current instance of ContextMenuEventBuilder .

Example:
C#
@( Html.Kendo().ContextMenu()
.Name("ContextMenu")
.Events(events =&gt; events.Close(
@&lt;text&gt;
function(e) {
//event handling code
}
&lt;/text&gt;
))
)

Defines the handler of the Close client-side event. Fires before a sub menu or the ContextMenu gets closed. You can cancel this event to prevent closure.

C#
public ContextMenuEventBuilder Close(string handler)
Parameters:handlerstring

The name of the JavaScript function that will handle the Close event.

Returns:

ContextMenuEventBuilder

Returns the current instance of ContextMenuEventBuilder .

Example:
C#
@( Html.Kendo().ContextMenu()
.Name("ContextMenu")
.Events(events =&gt; events.Close("onClose"))
)

Defines the handler of the DataBound client-side event. Fires when the ContextMenu is bound to the set DataSource.

C#
public ContextMenuEventBuilder DataBound(Func<object, object> handler)
Parameters:handlerFunc<object, object>

The handler code wrapped in a text tag.

Returns:

ContextMenuEventBuilder

Returns the current instance of ContextMenuEventBuilder .

Example:
C#
@( Html.Kendo().ContextMenu()
.Name("ContextMenu")
.Events(events =&gt; events.DataBound(
@&lt;text&gt;
function(e) {
//event handling code
}
&lt;/text&gt;
))
)

Defines the handler of the DataBound client-side event. Fires when the ContextMenu is bound to the set DataSource.

C#
public ContextMenuEventBuilder DataBound(string handler)
Parameters:handlerstring

The name of the JavaScript function that will handle the DataBound event.

Returns:

ContextMenuEventBuilder

Returns the current instance of ContextMenuEventBuilder .

Example:
C#
@( Html.Kendo().ContextMenu()
.Name("ContextMenu")
.Events(events =&gt; events.DataBound("onDataBound"))
)

Defines the handler of the Deactivate client-side event. Fires when a sub menu or the ContextMenu gets closed and its animation finished.

C#
public ContextMenuEventBuilder Deactivate(Func<object, object> handler)
Parameters:handlerFunc<object, object>

The handler code wrapped in a text tag.

Returns:

ContextMenuEventBuilder

Returns the current instance of ContextMenuEventBuilder .

Example:
C#
@( Html.Kendo().ContextMenu()
.Name("ContextMenu")
.Events(events =&gt; events.Deactivate(
@&lt;text&gt;
function(e) {
//event handling code
}
&lt;/text&gt;
))
)

Defines the handler of the Deactivate client-side event. Fires when a sub menu or the ContextMenu gets closed and its animation finished.

C#
public ContextMenuEventBuilder Deactivate(string handler)
Parameters:handlerstring

The name of the JavaScript function that will handle the Deactivate event.

Returns:

ContextMenuEventBuilder

Returns the current instance of ContextMenuEventBuilder .

Example:
C#
@( Html.Kendo().ContextMenu()
.Name("ContextMenu")
.Events(events =&gt; events.Deactivate("onDeactivate"))
)

Defines the handler of the Open client-side event. Fires before a sub menu or the ContextMenu gets opened. You can cancel this event to prevent opening the sub menu.

C#
public ContextMenuEventBuilder Open(Func<object, object> handler)
Parameters:handlerFunc<object, object>

The handler code wrapped in a text tag.

Returns:

ContextMenuEventBuilder

Returns the current instance of ContextMenuEventBuilder .

Example:
C#
@( Html.Kendo().ContextMenu()
.Name("ContextMenu")
.Events(events =&gt; events.Open(
@&lt;text&gt;
function(e) {
//event handling code
}
&lt;/text&gt;
))
)

Defines the handler of the Open client-side event. Fires before a sub menu or the ContextMenu gets opened. You can cancel this event to prevent opening the sub menu.

C#
public ContextMenuEventBuilder Open(string handler)
Parameters:handlerstring

The name of the JavaScript function that will handle the Open event.

Returns:

ContextMenuEventBuilder

Returns the current instance of ContextMenuEventBuilder .

Example:
C#
@( Html.Kendo().ContextMenu()
.Name("ContextMenu")
.Events(events =&gt; events.Open("onOpen"))
)

Defines the handler of the Select client-side event. Fires when a menu item gets selected.

C#
public ContextMenuEventBuilder Select(Func<object, object> handler)
Parameters:handlerFunc<object, object>

The handler code wrapped in a text tag.

Returns:

ContextMenuEventBuilder

Returns the current instance of ContextMenuEventBuilder .

Example:
C#
@( Html.Kendo().ContextMenu()
.Name("ContextMenu")
.Events(events =&gt; events.Select(
@&lt;text&gt;
function(e) {
//event handling code
}
&lt;/text&gt;
))
)

Defines the handler of the Select client-side event. Fires when a menu item gets selected.

C#
public ContextMenuEventBuilder Select(string handler)
Parameters:handlerstring

The name of the JavaScript function that will handle the Select event.

Returns:

ContextMenuEventBuilder

Returns the current instance of ContextMenuEventBuilder .

Example:
C#
@( Html.Kendo().ContextMenu()
.Name("ContextMenu")
.Events(events =&gt; events.Select("onSelect"))
)