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

A builder class for IUploadAsyncSettings

Definition

Namespace:Kendo.Mvc.UI.Fluent

Assembly:Kendo.Mvc.dll

Syntax:

C#
public class UploadAsyncSettingsBuilder

Inheritance: objectUploadAsyncSettingsBuilder

Inherited Members object.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 UploadAsyncSettingsBuilder class.

C#
public UploadAsyncSettingsBuilder(IUploadAsyncSettings asyncSettings)
Parameters:asyncSettingsIUploadAsyncSettings

The async settings.

Example:
C#
@( Html.Kendo().Upload()
.Name("Upload")
.Async(async => async
.Save("Save", "Home", new RouteValueDictionary{ {"id", 1} })
)
)

Methods

If the property is set the failed upload request will be repeated after the declared amount of ticks.

C#
public UploadAsyncSettingsBuilder AutoRetryAfter(double value)
Parameters:valuedouble

The value for AutoRetryAfter

Returns:

UploadAsyncSettingsBuilder

Example:
C#
@( Html.Kendo().Upload()
.Name("Upload")
.Async(async => async
.Save("Save", "Home")
.AutoRetryAfter(300)
)
)

Sets a value indicating whether to start the upload immediately after selecting a file

C#
public UploadAsyncSettingsBuilder AutoUpload(bool value)
Parameters:valuebool

true if the upload should start immediately after selecting a file, false otherwise; true by default

Returns:

UploadAsyncSettingsBuilder

Example:
C#
@( Html.Kendo().Upload()
.Name("Upload")
.Async(async => async
.Save("Save", "Home")
.AutoUpload(false)
)
)

Sets a value indicating whether to upload selected files in one batch (request)

C#
public UploadAsyncSettingsBuilder Batch(bool value)
Parameters:valuebool

true if the files should be uploaded in a single request, false otherwise; false by default

Returns:

UploadAsyncSettingsBuilder

Example:
C#
@( Html.Kendo().Upload()
.Name("Upload")
.Async(async => async
.Save("Save", "Home")
.Batch(true)
)
)

When the property is set the selected files will be uploaded chunk by chunk with the declared size. Each request sends a separate file blob and additional string metadata to the server. This metadata is a stringified JSON and contains chunkIndex, contentType, totalFileSize, totalChunks, uploadUid properties that allow validating and combining the file on the server side. The response also returns a JSON object with uploaded and fileUid properties that notifies the client which should be the next chunk.

C#
public UploadAsyncSettingsBuilder ChunkSize(double value)
Parameters:valuedouble

The value for ChunkSize

Returns:

UploadAsyncSettingsBuilder

Example:
C#
@( Html.Kendo().Upload()
.Name("Upload")
.Async(async => async
.Save("Chunk_Upload_Save", "Home")
.Remove("Chunk_Upload_Remove", "Home")
.ChunkSize(11000)
)
)

By default the selected files are uploaded one after another. When set to 'true' all the selected files start uploading simultaneously. (The property is available when the async.chunkSize is set.)

C#
public UploadAsyncSettingsBuilder Concurrent()
Returns:

UploadAsyncSettingsBuilder

Example:
C#
@( Html.Kendo().Upload()
.Name("Upload")
.Async(async => async
.Save("Chunk_Upload_Save", "Home")
.ChunkSize(11000)
.Concurrent()
)
)

By default the selected files are uploaded one after another. When set to 'true' all the selected files start uploading simultaneously. (The property is available when the async.chunkSize is set.)

C#
public UploadAsyncSettingsBuilder Concurrent(bool value)
Parameters:valuebool

The value for Concurrent

Returns:

UploadAsyncSettingsBuilder

Example:
C#
@( Html.Kendo().Upload()
.Name("Upload")
.Async(async => async
.Save("Chunk_Upload_Save", "Home")
.ChunkSize(11000)
.Concurrent(true)
)
)

It sets the number of attempts that will be performed if an upload is failing. The property is only used when the async.autoRetryAfter property is also defined.

C#
public UploadAsyncSettingsBuilder MaxAutoRetries(double value)
Parameters:valuedouble

The value for MaxAutoRetries

Returns:

UploadAsyncSettingsBuilder

Example:
C#
@( Html.Kendo().Upload()
.Name("Upload")
.Async(async => async
.Save("Save", "Home")
.AutoRetryAfter(300)
.MaxAutoRetries(4)
)
)

Sets the route values for the remove operation

C#
public UploadAsyncSettingsBuilder Remove(RouteValueDictionary routeValues)
Parameters:routeValuesRouteValueDictionary

The route values of the action method.

Returns:

UploadAsyncSettingsBuilder

Example:
C#
@( Html.Kendo().Upload()
.Name("Upload")
.Async(async => async
.Remove(MVC.Home.Remove(1).GetRouteValueDictionary())
)
)

Sets the route and values for the remove operation

C#
public UploadAsyncSettingsBuilder Remove(string routeName, object routeValues)
Parameters:routeNamestring

Name of the route.

routeValuesobject

The route values.

Returns:

UploadAsyncSettingsBuilder

Example:
C#
@( Html.Kendo().Upload()
.Name("Upload")
.Async(async => async
.Remove("Default", new { id = 1 })
)
)

Sets the route and values for the remove operation

C#
public UploadAsyncSettingsBuilder Remove(string routeName, RouteValueDictionary routeValues)
Parameters:routeNamestring

Name of the route.

routeValuesRouteValueDictionary

The route values.

Returns:

UploadAsyncSettingsBuilder

Example:
C#
@( Html.Kendo().Upload()
.Name("Upload")
.Async(async => async
.Remove("Default", new RouteValueDictionary{ {"id", 1} })
)
)

Sets the action, controller and route values for the remove operation

C#
public UploadAsyncSettingsBuilder Remove(string actionName, string controllerName, object routeValues)
Parameters:actionNamestring

Name of the action.

controllerNamestring

Name of the controller.

routeValuesobject

The route values.

Returns:

UploadAsyncSettingsBuilder

Example:
C#
@( Html.Kendo().Upload()
.Name("Upload")
.Async(async => async
.Remove("Remove", "Home", new { id = 1 })
)
)

Sets the action, controller and route values for the remove operation

C#
public UploadAsyncSettingsBuilder Remove(string actionName, string controllerName, RouteValueDictionary routeValues)
Parameters:actionNamestring

Name of the action.

controllerNamestring

Name of the controller.

routeValuesRouteValueDictionary

The route values.

Returns:

UploadAsyncSettingsBuilder

Example:
C#
@( Html.Kendo().Upload()
.Name("Upload")
.Async(async => async
.Remove("Remove", "Home", new RouteValueDictionary{ {"id", 1} })
)
)

Sets the action and controller for the remove operation

C#
public UploadAsyncSettingsBuilder Remove(string actionName, string controllerName)
Parameters:actionNamestring

Name of the action.

controllerNamestring

Name of the controller.

Returns:

UploadAsyncSettingsBuilder

Example:
C#
@( Html.Kendo().Upload()
.Name("Upload")
.Async(async => async
.Remove("Remove", "Home")
)
)

Sets the route name for the remove operation

C#
public UploadAsyncSettingsBuilder Remove(string routeName)
Parameters:routeNamestring

Name of the route.

Returns:

UploadAsyncSettingsBuilder

Example:
C#
@( Html.Kendo().Upload()
.Name("Upload")
.Async(async => async
.Remove("Default")
)
)

Sets the action for the remove operation

C#
public UploadAsyncSettingsBuilder Remove<TController>(Expression<Action<TController>> controllerAction) where TController : Controller
Parameters:controllerActionExpression<Action<TController>>

The action.

Returns:

UploadAsyncSettingsBuilder

Example:
C#
@( Html.Kendo().Upload()
.Name("Upload")
.Async(async =&gt; async
.Remove&lt;HomeController&gt;(controller =&gt; controller.Remove())
)
)

Sets the field name for the remove operation

C#
public UploadAsyncSettingsBuilder RemoveField(string fieldName)
Parameters:fieldNamestring

The form field name to use for submiting the files. "fileNames" is used if not set.

Returns:

UploadAsyncSettingsBuilder

Example:
C#
@( Html.Kendo().Upload()
.Name("Upload")
.Async(async =&gt; async
.RemoveField("attachments")
)
)

Sets an absolute or relative Remove action URL. Note that the URL must be in the same domain for the operation to succeed.

C#
public UploadAsyncSettingsBuilder RemoveUrl(string url)
Parameters:urlstring

The Remove action URL.

Returns:

UploadAsyncSettingsBuilder

Example:
C#
@( Html.Kendo().Upload()
.Name("Upload")
.Async(async =&gt; async
.RemoveUrl("/remove")
)
)

Sets the route values for the save operation

C#
public UploadAsyncSettingsBuilder Save(RouteValueDictionary routeValues)
Parameters:routeValuesRouteValueDictionary

The route values of the action method.

Returns:

UploadAsyncSettingsBuilder

Example:
C#
@( Html.Kendo().Upload()
.Name("Upload")
.Async(async =&gt; async
.Save(MVC.Home.Save(1).GetRouteValueDictionary())
)
)

Sets the route and values for the save operation

C#
public UploadAsyncSettingsBuilder Save(string routeName, object routeValues)
Parameters:routeNamestring

Name of the route.

routeValuesobject

The route values.

Returns:

UploadAsyncSettingsBuilder

Example:
C#
@( Html.Kendo().Upload()
.Name("Upload")
.Async(async =&gt; async
.Save("Default", new { id = 1 })
)
)

Sets the route and values for the save operation

C#
public UploadAsyncSettingsBuilder Save(string routeName, RouteValueDictionary routeValues)
Parameters:routeNamestring

Name of the route.

routeValuesRouteValueDictionary

The route values.

Returns:

UploadAsyncSettingsBuilder

Example:
C#
@( Html.Kendo().Upload()
.Name("Upload")
.Async(async =&gt; async
.Save("Default", new RouteValueDictionary{ {"id", 1} })
)
)

Sets the action, controller and route values for the save operation

C#
public UploadAsyncSettingsBuilder Save(string actionName, string controllerName, object routeValues)
Parameters:actionNamestring

Name of the action.

controllerNamestring

Name of the controller.

routeValuesobject

The route values.

Returns:

UploadAsyncSettingsBuilder

Example:
C#
@( Html.Kendo().Upload()
.Name("Upload")
.Async(async =&gt; async
.Save("Save", "Home", new { id = 1 })
)
)

Sets the action, controller and route values for the save operation

C#
public UploadAsyncSettingsBuilder Save(string actionName, string controllerName, RouteValueDictionary routeValues)
Parameters:actionNamestring

Name of the action.

controllerNamestring

Name of the controller.

routeValuesRouteValueDictionary

The route values.

Returns:

UploadAsyncSettingsBuilder

Example:
C#
@( Html.Kendo().Upload()
.Name("Upload")
.Async(async =&gt; async
.Save("Save", "Home", new RouteValueDictionary{ {"id", 1} })
)
)

Sets the action and controller for the save operation

C#
public UploadAsyncSettingsBuilder Save(string actionName, string controllerName)
Parameters:actionNamestring

Name of the action.

controllerNamestring

Name of the controller.

Returns:

UploadAsyncSettingsBuilder

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

Sets the route name for the save operation

C#
public UploadAsyncSettingsBuilder Save(string routeName)
Parameters:routeNamestring

Name of the route.

Returns:

UploadAsyncSettingsBuilder

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

Sets the action for the save operation

C#
public UploadAsyncSettingsBuilder Save<TController>(Expression<Action<TController>> controllerAction) where TController : Controller
Parameters:controllerActionExpression<Action<TController>>

The action.

Returns:

UploadAsyncSettingsBuilder

Example:
C#
@( Html.Kendo().Upload()
.Name("Upload")
.Async(async =&gt; async
.Save&lt;HomeController&gt;(controller =&gt; controller.Save())
)
)

Sets the field name for the save operation

C#
public UploadAsyncSettingsBuilder SaveField(string fieldName)
Parameters:fieldNamestring

The form field name to use for submiting the files. The Upload name is used if not set.

Returns:

UploadAsyncSettingsBuilder

Example:
C#
@( Html.Kendo().Upload()
.Name("Upload")
.Async(async =&gt; async
.SaveField("attachment")
)
)

Sets an absolute or relative Save action URL. Note that the URL must be in the same domain for the upload to succeed.

C#
public UploadAsyncSettingsBuilder SaveUrl(string url)
Parameters:urlstring

The Save action URL.

Returns:

UploadAsyncSettingsBuilder

Example:
C#
@( Html.Kendo().Upload()
.Name("Upload")
.Async(async =&gt; async
.SaveUrl("/save")
)
)

By default, the files are uploaded as filedata. When set to true, the files are read as file buffer by using FileReader and this buffer is send in the request body.

C#
public UploadAsyncSettingsBuilder UseArrayBuffer(bool useArrayBuffer)
Parameters:useArrayBufferbool

true if arrayBuffer should be send; false by default

Returns:

UploadAsyncSettingsBuilder

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

Sets a value indicating whether to send credentials (cookies, headers) for cross-site requests.

C#
public UploadAsyncSettingsBuilder WithCredentials(bool withCredentials)
Parameters:withCredentialsbool

true if credentials should be sent, false otherwise; true by default

Returns:

UploadAsyncSettingsBuilder

Example:
C#
@( Html.Kendo().Upload()
.Name("Upload")
.Async(async =&gt; async
.WithCredentials(false)
)
)