Skip to main content
Tab

ASPxUploadControl.FileUploadMode Property

Gets or sets a value that specifies when the file upload should be performed.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v24.1.dll

NuGet Package: DevExpress.Web

Declaration

[DefaultValue(UploadControlFileUploadMode.BeforePageLoad)]
public UploadControlFileUploadMode FileUploadMode { get; set; }

Property Value

Type Default Description
UploadControlFileUploadMode BeforePageLoad

One of the UploadControlFileUploadMode enumeration values.

Available values:

Name Description
BeforePageLoad

Specifies that the file upload process is automatically executed before Page_Load event.

OnPageLoad

Specifies that the file upload process is automatically executed on Page_Load event.

Remarks

The FileUploadMode property controls whether the file upload is performed on the server side, either during a server Page_Load event (the OnPageLoad value), or before a server Page_Load event ( the BeforePageLoad value).

When the FileUploadMode property is set to the default BeforePageLoad value, a file is uploaded and the request execution is aborted before the Page_Init method is called. Thus, controls are not initialized and not available in file upload events. Set the FileUploadMode property to OnPageLoad to rebuild the page hierarchy before the ASPxUploadControl requires them. In this case, control properties are available in file upload events.

Example

This example demonstrates how ASPxUploadControl can get the information from other controls on the page in a file upload process (within ASPxUploadControl.FileUploadComplete event handler). Note that the ASPxUploadControl.FileUploadMode property must be set to OnPageLoad. In this case, a page hierarchy is rebuilt and control properties are available before the ASPxUploadControl requires them.

protected void ASPxUploadControl1_FileUploadComplete(object sender, DevExpress.Web.FileUploadCompleteEventArgs e) {
        string fileName = "D:/" + ASPxRadioButtonList1.Value + "/" + e.UploadedFile.FileName;
        e.UploadedFile.SaveAs(fileName);
    }
See Also