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

UploadBuilder

Defines the fluent interface for configuring the Upload component.

Methods

Events(System.Action)

Configures the client-side events.

Parameters

configurator - System.Action<UploadEventBuilder>

The client events configuration action.

Example


             @( Html.Kendo().Upload()
                        .Name("Upload")
                        .Events(events => events
                            .Upload("onUpload")
                        )
            )

Enable(System.Boolean)

Enables or disables the component.

Parameters

value - System.Boolean

true if the component should be enabled, false otherwise; the default is true.

Example


             @( Html.Kendo().Upload()
                        .Name("Upload")
                        .Enable(false)
            )

Directory(System.Boolean)

Enables selection of folders instead of files. When a directory is selected, its entire hierarchy of contents files is included in the set of selected items. It is only supported in browsers that support webkitdirectory.

Parameters

value - System.Boolean

true allows directory upload.

Example


             @( Html.Kendo().Upload()
                        .Name("Upload")
                        .Directory(true)
            )

DirectoryDrop(System.Boolean)

Enables dropping folders over the upload and its drop zone. When a directory is dropped, its entire hierarchy of contents files is included in the set of selected items. It is only supported in browsers that support DataTransferItem and webkitGetAsEntry.

Parameters

value - System.Boolean

true allows directory drop.

Example


             @( Html.Kendo().Upload()
                        .Name("Upload")
                        .DirectoryDrop(true)
            )

Multiple(System.Boolean)

Enables or disables multiple file selection.

Parameters

value - System.Boolean

true if multiple file selection should be enabled, false otherwise; the default is true.

Example


             @( Html.Kendo().Upload()
                        .Name("Upload")
                        .Multiple(false)
            )

ShowFileList(System.Boolean)

Sets a value indicating whether to show the list of uploaded files

Parameters

value - System.Boolean

true if the list of uploaded files should be visible, false otherwise; true by default

Async(System.Action)

Use it to configure asynchronous uploading.

Parameters

configurator - System.Action<UploadAsyncSettingsBuilder>

Use builder to set different asynchronous uploading options.

Example


             @( Html.Kendo().Upload()
                        .Name("Upload")
                        .Async(async => async
                            .Save("Save", "Compose")
                            .Remove("Remove", "Compose")
                        );
            )

Validation(System.Action)

Use it to configure validation.

Parameters

configurator - System.Action<UploadValidationSettingsBuilder>

Use builder to set different validation options.

Example


             @( Html.Kendo().Upload()
                        .Name("Upload")
                        .Validation(async => async
                            .MaxFileSize(900000)
                        );
            )

Messages(System.Action)

Use it to configure asynchronous uploading.

Parameters

configurator - System.Action<UploadMessagesBuilder>

Use builder to set different asynchronous uploading options.

Example


             @( Html.Kendo().Upload()
                        .Name("Upload")
                        .Async(async => async
                            .Save("Save", "Compose")
                            .Remove("Remove", "Compose")
                        );
            )

TemplateId(System.String)

The template element to be used for rendering the files in the list

Parameters

templateId - System.String

The id of the template

Example


            @( Html.Kendo().Upload()
                        .Name("Upload")
                        .TemplateId("fileTemplate")
                        .Async(async => async
                            .Save("Save", "Compose")
                            .Remove("Remove", "Compose")
                        )
            )

DropZone(System.String)

The string jQuery selector for the DropZone

Parameters

dropZone - System.String

The string jQuery selector for the DropZone

Example


            @( Html.Kendo().Upload()
                        .Name("Upload")
                        .DropZone("DropZone")
                        .Async(async => async
                            .Save("Save", "Compose")
                            .Remove("Remove", "Compose")
                        )
            )

Files(System.Action)

Sets the initially rendered files

Parameters

configurator - System.Action<UploadFileFactory>

The lambda which configures initial files

Example


            @(Html.Kendo().Upload()
                .Name("files")
                .Files(files => files.Add().Name("file.txt").Size(500).Extension(".txt"))
                .Async(a => a
                    .Save("Save", "Compose")
                    .Remove("Remove", "Compose")
                    .AutoUpload(true)
                )
            )

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>

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?