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

Defines the fluent API for configuring the Kendo UI Upload

Definition

Namespace:Kendo.Mvc.UI.Fluent

Assembly:Kendo.Mvc.dll

Syntax:

C#
public class UploadBuilder : MvvmWidgetBuilderBase<Upload, UploadBuilder>, IHtmlContent

Inheritance: objectHelperResultWidgetBuilderBase<Upload, UploadBuilder>MvvmWidgetBuilderBase<Upload, UploadBuilder>UploadBuilder

Implements: IHtmlContent

Inherited Members MvvmWidgetBuilderBase<Upload, UploadBuilder>.UseMvvmInitialization(bool)MvvmWidgetBuilderBase<Upload, UploadBuilder>.UseMvvmInitialization()WidgetBuilderBase<Upload, UploadBuilder>.ToComponent()WidgetBuilderBase<Upload, UploadBuilder>.Expression(string)WidgetBuilderBase<Upload, UploadBuilder>.Explorer(ModelExplorer)WidgetBuilderBase<Upload, UploadBuilder>.Name(string)WidgetBuilderBase<Upload, UploadBuilder>.Deferred(bool)WidgetBuilderBase<Upload, UploadBuilder>.HtmlAttributes(object)WidgetBuilderBase<Upload, UploadBuilder>.HtmlAttributes(IDictionary<string, object>)WidgetBuilderBase<Upload, UploadBuilder>.ScriptAttributes(object, bool)WidgetBuilderBase<Upload, UploadBuilder>.ScriptAttributes(IDictionary<string, object>, bool)WidgetBuilderBase<Upload, UploadBuilder>.Render()WidgetBuilderBase<Upload, UploadBuilder>.ToHtmlString()WidgetBuilderBase<Upload, UploadBuilder>.WriteTo(TextWriter, HtmlEncoder)WidgetBuilderBase<Upload, UploadBuilder>.ToClientTemplate()WidgetBuilderBase<Upload, UploadBuilder>.AsModule(bool)WidgetBuilderBase<Upload, UploadBuilder>.ComponentWidgetBuilderBase<Upload, UploadBuilder>.ContainerHelperResult.WriteTo(TextWriter, HtmlEncoder)HelperResult.WriteActionobject.GetType()object.MemberwiseClone()object.ToString()object.Equals(object)object.Equals(object, object)object.ReferenceEquals(object, object)object.GetHashCode()...

Constructors

Initializes a new instance of the UploadBuilder class.

C#
public UploadBuilder(Upload component)
Parameters:componentUpload

Methods

Configures the asynchronous upload of files. For more details, refer to the article on the async mode of the Upload.

C#
public UploadBuilder Async(Action<UploadAsyncSettingsBuilder> configurator)
Parameters:configuratorAction<UploadAsyncSettingsBuilder>

The UploadAsyncSettingsBuilder for the async setting.

Returns:

UploadBuilder

Returns the current instance of UploadBuilder .

Enables the selection of folders instead of files. When the user selects a directory, its entire content hierarchy of files is included in the set of selected items. The directory setting is available only in browsers which support webkitdirectory.

C#
public UploadBuilder Directory()
Returns:

UploadBuilder

Returns the current UploadBuilder instance.

Enables the selection of folders instead of files. When the user selects a directory, its entire content hierarchy of files is included in the set of selected items. The directory setting is available only in browsers which support webkitdirectory.

C#
public UploadBuilder Directory(bool value)
Parameters:valuebool

The value for Directory

Returns:

UploadBuilder

Returns the current UploadBuilder instance.

Example:
C#
@( Html.Kendo().Upload()
.Name("Upload")
.Directory(true)
)

Enables the dropping of folders over the Upload and its drop zone. When a directory is dropped, its entire content hierarchy of files is included in the set of selected items. The directoryDrop setting is available only in browsers which support DataTransferItem and webkitGetAsEntry.

C#
public UploadBuilder DirectoryDrop()
Returns:

UploadBuilder

Returns the current UploadBuilder instance.

Enables the dropping of folders over the Upload and its drop zone. When a directory is dropped, its entire content hierarchy of files is included in the set of selected items. The directoryDrop setting is available only in browsers which support DataTransferItem and webkitGetAsEntry.

C#
public UploadBuilder DirectoryDrop(bool value)
Parameters:valuebool

The value for DirectoryDrop

Returns:

UploadBuilder

Returns the current UploadBuilder instance.

Example:
C#
@( Html.Kendo().Upload()
.Name("Upload")
.DirectoryDrop(true)
)

Initializes a drop-zone element based on a given selector, which provides the drag-and-drop file upload.

C#
public UploadBuilder DropZone(string value)
Parameters:valuestring

The value for DropZone

Returns:

UploadBuilder

Returns the current UploadBuilder instance.

Example:
C#
@( Html.Kendo().Upload()
.Name("Upload")
.DropZone("DropZone")
.Async(async =&gt; async
.Save("Save", "Home")
.Remove("Remove", "Home")
)
)

Enables or disables the Upload component.

C#
public UploadBuilder Enable(bool value)
Parameters:valueboolReturns:

UploadBuilder

Configures the client-side events.

C#
public UploadBuilder Events(Action<UploadEventBuilder> configurator)
Parameters:configuratorAction<UploadEventBuilder>

The client events action.

Returns:

UploadBuilder

Returns the current UploadBuilder instance.

Example:
C#
@(Html.Kendo().Upload()
.Name("Upload")
.Events(events =&gt; events
.Cancel("onCancel")
)
)

The list of files that will be initially rendered in the files list of the Upload.Each file object in the array has to contain the following properties: name; size or extension.

C#
public UploadBuilder Files(Action<UploadFileFactory> configurator)
Parameters:configuratorAction<UploadFileFactory>

The UploadFileFactory for the files setting.

Returns:

UploadBuilder

Returns the current instance of UploadBuilder .

Sets the strings rendered by the Upload.

C#
public UploadBuilder Messages(Action<UploadMessagesSettingsBuilder> configurator)
Parameters:configuratorAction<UploadMessagesSettingsBuilder>

The configurator for the localization setting.

Returns:

UploadBuilder

Returns the current UploadBuilder instance.

Enables (if set to true) or disables (if set to false) the selection of multiple files. If set to false, the user can select only one file at a time.

C#
public UploadBuilder Multiple(bool value)
Parameters:valuebool

The value for Multiple

Returns:

UploadBuilder

Returns the current UploadBuilder instance.

Example:
C#
@( Html.Kendo().Upload()
.Name("Upload")
.Multiple(false)
)

Enables (if set to true) or disables (if set to false) the display of a file listing for the file upload. The disabling of a file listing might be useful if you want to customize the UI. To build your own UI, use the client-side events.

C#
public UploadBuilder ShowFileList(bool value)
Parameters:valuebool

The value for ShowFileList

Returns:

UploadBuilder

Returns the current UploadBuilder instance.

Example:
C#
@( Html.Kendo().Upload()
.Name("Upload")
.ShowFileList(false)
)

Sets a template for rendering the files in the file list.The template data Array consists of: name - The name of the file. If in batch upload mode, represents a string combination of all file names separated with comma.; size - The file size in bytes. If in batch upload mode, represents the total file size. If not available, the value is null. or files - An array which contains information about all selected files (name, size, and extension)..

C#
public UploadBuilder Template(string value)
Parameters:valuestring

The value for Template

Returns:

UploadBuilder

Returns the current UploadBuilder instance.

Example:
C#
@(Html.Kendo().Upload()
.Name("Upload")
.Template(Html.Kendo().Template().AddHtml("&lt;div class='file-wrapper'&gt;&lt;h4 class='file-heading file-name-heading'&gt;Name: ${data.name}&lt;/h4&gt;&lt;/div&gt;"))
.Async(async =&gt; async
.Save("Save", "Home")
.Remove("Remove", "Home")
)
)

Sets a template for rendering the files in the file list.The template data Array consists of: name - The name of the file. If in batch upload mode, represents a string combination of all file names separated with comma.; size - The file size in bytes. If in batch upload mode, represents the total file size. If not available, the value is null. or files - An array which contains information about all selected files (name, size, and extension)..

C#
public UploadBuilder Template<TModel>(TemplateBuilder<TModel> template)
Parameters:templateTemplateBuilder<TModel>

A Template component that configures the template.

Returns:

UploadBuilder

Returns the current UploadBuilder instance.

Sets a template for rendering the files in the file list.The template data Array consists of: name - The name of the file. If in batch upload mode, represents a string combination of all file names separated with comma.; size - The file size in bytes. If in batch upload mode, represents the total file size. If not available, the value is null. or files - An array which contains information about all selected files (name, size, and extension)..

C#
public UploadBuilder TemplateHandler(string templateHandler)
Parameters:templateHandlerstring

The handler that returs the template for Template

Returns:

UploadBuilder

Returns the current UploadBuilder instance.

Example:
C#
@(Html.Kendo().Upload()
.Name("Upload")
.TemplateHandler("fileTemplate")
.Async(async =&gt; async
.Save("Save", "Home")
.Remove("Remove", "Home")
)
)

Sets a template for rendering the files in the file list.The template data Array consists of: name - The name of the file. If in batch upload mode, represents a string combination of all file names separated with comma.; size - The file size in bytes. If in batch upload mode, represents the total file size. If not available, the value is null. or files - An array which contains information about all selected files (name, size, and extension)..

C#
public UploadBuilder TemplateId(string templateId)
Parameters:templateIdstring

The ID of the template element for Template

Returns:

UploadBuilder

Returns the current UploadBuilder instance.

Example:
C#
@(Html.Kendo().Upload()
.Name("Upload")
.TemplateId("fileTemplate")
.Async(async =&gt; async
.Save("Save", "Home")
.Remove("Remove", "Home")
)
)

Sets a template for rendering the files in the file list.The template data Array consists of: name - The name of the file. If in batch upload mode, represents a string combination of all file names separated with comma.; size - The file size in bytes. If in batch upload mode, represents the total file size. If not available, the value is null. or files - An array which contains information about all selected files (name, size, and extension)..

C#
public UploadBuilder TemplateView(IHtmlContent templateView)
Parameters:templateViewIHtmlContent

The view that contains the template for Template

Returns:

UploadBuilder

Returns the current UploadBuilder instance.

Example:
C#
@( Html.Kendo().Upload()
.Name("Upload")
.TemplateView(Html.Partial("TemplateView"))
.Async(async =&gt; async
.Save("Save", "Compose")
.Remove("Remove", "Compose")
)
)

Configures the validation options for uploaded files.

C#
public UploadBuilder Validation(Action<UploadValidationSettingsBuilder> configurator)
Parameters:configuratorAction<UploadValidationSettingsBuilder>

The UploadValidationSettingsBuilder for the validation setting.

Returns:

UploadBuilder

Returns the current instance of UploadBuilder .