EditorBuilder
Methods
Value(System.Action)
Sets the HTML content that will show initially in the Editor.
Parameters
value - System.Action
The action that renders the HTML content.
Example
@(Html.Kendo().Editor()
.Name("Editor")
.Value(@<text>
<blockquote>
According to Deep Thought, the answer to the ultimate question of
life, the universe and everything is <strong>42</strong>.
</blockquote>
</text>)
)
Value(System.Func)
Sets the HTML content that will show initially in the Editor.
Parameters
value - System.Func<Object,Object>
The predicate that renders the HTML content.
Example
@(Html.Kendo().Editor()
.Name("Editor")
.Value(@<text>
<blockquote>
According to Deep Thought, the answer to the ultimate question of
life, the universe and everything is <strong>42</strong>.
</blockquote>
</text>)
)
Value(System.String)
Sets the HTML content that will show initially in the Editor as a string.
Parameters
value - System.String
An HTML string.
Example
@( Html.Kendo().Editor()
.Name("Editor")
.Value("<blockquote>A towel has <strong>immense</strong> psychological value</blockquote>")
)
Events(System.Action)
Configures the client events.
Parameters
configurator - System.Action<EditorEventBuilder>
The action that configures the client events.
Example
@( Html.Kendo().Editor()
.Name("Editor")
.Events(events => events
.Change("onChange")
)
)
Tools(System.Action)
Configures the available tools in the toolbar.
Parameters
configurator - System.Action<EditorToolFactory>
The action that configures the tools.
Example
@( Html.Kendo().Editor()
.Name("Editor")
.Tools(tools => tools
.Clear()
.Bold()
.Italic()
.Underline()
)
)
Tag(System.String)
Allows rendering of contentEditable elements instead of the default textarea Editor. Note: contentEditable elements are not posted to the server.
Parameters
tagName - System.String
The tag that will be rendered as contentEditable
Example
@( Html.Kendo().Editor()
.Name("Editor")
.Tag("div")
)
Encode(System.Boolean)
Encodes the HTML content. By default, the submitted value is encoded.
Parameters
value - System.Boolean
Example
@( Html.Kendo().Editor()
.Name("Editor")
.Value("<blockquote>A towel has <strong>immense</strong> psychological value</blockquote>")
.Encode(true)
)
Pdf(System.Action)
Configures the PDF export settings.
Parameters
configurator - System.Action<PDFSettingsBuilder>
The action that configures the PDF settings.
Example
@(Html.Kendo().Editor()
.Name("Editor")
.Pdf(pdf => pdf
.Margin(20, 20, 20, 20)
.PaperSize("A4")
.ProxyURL(Url.Action("Pdf_Export_Save", "Editor"))
)
)
StyleSheets(System.Action)
Sets the CSS files that will be registered in the Editor's iframe
Parameters
configurator - System.Action<EditorStyleSheetBuilder>
The action that configures the StyleSheets settings.
Example
@( Html.Kendo().Editor()
.Name("Editor")
.StyleSheets(styleSheets => styleSheets.Add("editorStyles.css"))
)
FileBrowser(System.Action)
Configures the file browser dialog.
Parameters
configurator - System.Action<EditorFileBrowserSettingsBuilder>
The action that configures the file browser dialog.
Example
@( Html.Kendo().Editor()
.Name("Editor")
.FileBrowser(fileBrowser => fileBrowser
.File("~/Content/UserFiles/{0}")
.Read("Read", "FileBrowser")
.Create("Create", "FileBrowser")
.Destroy("Destroy", "FileBrowser")
.Upload("Upload", "FileBrowser")
)
)
ImageBrowser(System.Action)
Configures the image browser dialog.
Parameters
configurator - System.Action<EditorImageBrowserSettingsBuilder>
The action that configures the image browser dialog.
Example
@( Html.Kendo().Editor()
.Name("Editor")
.ImageBrowser(imageBrowser => imageBrowser
.Image("~/Content/UserFiles/Images/{0}")
.Read("Read", "ImageBrowser")
.Create("Create", "ImageBrowser")
.Destroy("Destroy", "ImageBrowser")
.Upload("Upload", "ImageBrowser")
.Thumbnail("Thumbnail", "ImageBrowser")
)
)
ExportAs(System.Action)
Configures the export settings.
Parameters
configurator - System.Action<EditorExportAsSettingsBuilder>
The action that configures the ExportAs settings.
Example
@( Html.Kendo().Editor()
.Name("Editor")
.ExportAs(exportAs => exportAs
.FileName("Editor")
.Proxy("Export", "Editor")
)
)
Import(System.Action)
Configures the import settings.
Parameters
configurator - System.Action<EditorImportSettingsBuilder>
The action that configures the Import settings.
Example
@( Html.Kendo().Editor()
.Name("Editor")
.Import(import => import
.Proxy("Import", "Editor")
)
)
Deserialization(System.Action)
Fine-tune deserialization in the Editor component. Deserialization is the process of parsing the HTML string input from the value() method or from the viewHtml dialog into editable content.
Parameters
configurator - System.Action<EditorDeserializationSettingsBuilder>
The action that configures the deserialization.
Example
@( Html.Kendo().Editor()
.Name("Editor")
.Deserialization(d => d.Custom("htmlDeserialization"))
)
<script>
function htmlDeserialization(html) {
return html.replace(/(<\/?)b(\s?)/, "$1strong$2");
}
</script>
Domain(System.String)
Relaxes the same-origin policy when using the iframe-based Editor. This is done automatically for all cases except when the policy is relaxed by document.domain = document.domain. In that case, this property must be used to allow the Editor to function properly across browsers. This property has been introduced in internal builds after 2014.1.319.
Parameters
value - System.String
The value that configures the domain.
Example
@( Html.Kendo().Editor()
.Name("Editor")
.Domain("example.com")
)
Immutables()
If enabled, the Editor disables the editing and command execution in elements marked with editablecontent="false" attribute.
Example
@(Html.Kendo().Editor()
.Name("Editor")
.Immutables()
)
Immutables(System.Boolean)
If enabled, the Editor disables the editing and command execution in elements marked with editablecontent="false" attribute.
Parameters
enabled - System.Boolean
Enables or disables the immutables option.
Example
@(Html.Kendo().Editor()
.Name("Editor")
.Immutables(false)
)
Immutables(System.Action)
If enabled, the Editor disables the editing and command execution in elements marked with editablecontent="false" attribute.
Parameters
configurator - System.Action<EditorImmutablesSettingsBuilder>
The action that configures the immutables.
Example
@(Html.Kendo().Editor()
.Name("Editor")
.Immutables(immutables => {
immutables.SerializationHandler("immutablesSerialization");
immutables.Deserialization("immutablesDeserialization");
})
)
InlineHeight(System.Double)
This property enables you to configure height for the Editor when the component is in inline mode.
Parameters
value - System.Double
The value that configures the inlineheight.
Messages(System.Action)
Defines the text of the labels that are shown within the editor. Used primarily for localization.
Parameters
configurator - System.Action<EditorMessagesSettingsBuilder>
The action that configures the messages.
Example
@(Html.Kendo().Editor()
.Name("Editor")
.Messages(messages => messages.CreateTable("New Table"))
)
Nonce(System.String)
When strict CSP is enabled a nonce can be provided for the inline styles. The passed value would be used as the nonce attribute for the inline styles in the content area iframe, the placeholder inline style and the link tags loading external stylesheets in the content area.
Parameters
value - System.String
The value that configures the nonce.
NavigateOnTab(System.Boolean)
If set to true this configuration option would enable Tab-based navigation among Editor ToolBar items. By default navigation is arrow-based.
Parameters
value - System.Boolean
The value that configures the navigateontab.
NonSplittableTagsOnPaste(System.Action)
When pasting a block element inside an element such as a list ul, the list gets split in half and the block element is inserted between the two ul elements.This configuration enables you to specify elements for which the above behavior will be ignored.
Parameters
configurator - System.Action<EditorNonSplittableTagsOnPasteFactory>
The action that configures the nonsplittabletagsonpaste.
PasteCleanup(System.Action)
Options for controlling how the pasting content is modified before it is added in the editor.
Parameters
configurator - System.Action<EditorPasteCleanupSettingsBuilder>
The action that configures the pastecleanup.
Placeholder(System.String)
The hint displayed by the Editor when it is empty. Not set by default.
Parameters
value - System.String
The value that configures the placeholder.
Example
@(Html.Kendo().Editor()
.Name("Editor")
.Placeholder("Enter some text")
)
Resizable()
If enabled, the Editor renders a resize handle to allow users to resize it.
Example
@(Html.Kendo().Editor()
.Name("Editor")
.Resizable()
)
Resizable(System.Boolean)
If enabled, the Editor renders a resize handle to allow users to resize it.
Parameters
enabled - System.Boolean
Enables or disables the resizable option.
Example
@(Html.Kendo().Editor()
.Name("Editor")
.Resizable(true)
)
Resizable(System.Action)
If enabled, the Editor renders a resize handle to allow users to resize it.
Parameters
configurator - System.Action<EditorResizableSettingsBuilder>
The action that configures the resizable.
Example
@(Html.Kendo().Editor()
.Name("Editor")
.Resizable(resize => resize.Content(true))
)
Serialization(System.Action)
Allows setting of serialization options.
Parameters
configurator - System.Action<EditorSerializationSettingsBuilder>
The action that configures the serialization.
Example
@( Html.Kendo().Editor()
.Name("Editor")
.Serialization(d => d.Custom("htmlSerialization"))
)
<script>
function htmlSerialization(html) {
return html.replace(/(<\/?)b(\s?)/, "$1strong$2");
}
</script>
FormattingMarksRefreshDelay(System.Double)
The delay in milliseconds before the formatting marks are refreshed. This feature is useful for performance optimization as the formatting marks are re-rendered any time the user presses a key. If the user is typing very fast or holding down a key, the delay will prevent the re-rendering from being executed multiple times.The visual effect from this configuration is that the marks will briefly disappear while the user is typing. You can set the value to false to fully turn off this behavior.
Parameters
value - System.Double
The value that configures the formattingmarksrefreshdelay.
UnsafeInline(System.Boolean)
When set to false, the decoration applied by the Formatting tool dropdown will be skipped and the values will appear as plain text options.
Parameters
value - System.Boolean
The value that configures the unsafeinline.
FormattingMarksRefreshDelay(System.Boolean)
The delay in milliseconds before the formatting marks are refreshed. This feature is useful for performance optimization as the formatting marks are re-rendered any time the user presses a key. If the user is typing very fast or holding down a key, the delay will prevent the re-rendering from being executed multiple times.The visual effect from this configuration is that the marks will briefly disappear while the user is typing. You can set the value to false to fully turn off this behavior.
Parameters
value - System.Boolean
The value that configures the formattingmarksrefreshdelay.
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
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>
AsModule(System.Boolean)
Specifies whether the initialization script of the component will be rendered as a JavaScript module.
Parameters
value - System.Boolean
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();
)
ScriptAttributes(System.Object,System.Boolean)
Sets the JavaScript attributes to the initialization script.
Parameters
attributes - System.Object
The JavaScript attributes.
overrideAttributes - System.Boolean
Argument which determines whether attributes should be overriden.
ScriptAttributes(System.Collections.Generic.IDictionary,System.Boolean)
Sets the JavaScript attributes to the initialization script.
Parameters
attributes - System.Collections.Generic.IDictionary<String,Object>
The JavaScript attributes.
overrideAttributes - System.Boolean
Argument which determines whether attributes should be overriden.