FileUploadCompleteEventArgs.CallbackData Property
Gets or sets a string that contains specific information (if any) to be passed from the server side to the client.
Namespace: DevExpress.Web
Assembly: DevExpress.Web.v24.2.dll
Declaration
Property Value
Type | Description |
---|---|
String | A String value representing callback data. |
Remarks
Use the CallbackData property to define specific information which has been collected on the server side, and should be passed to the client for further processing within the ASPxClientUploadControl.FileUploadComplete client event.
The example below demonstrates how to upload an image to the server and display the uploaded image on a web page:
<script type="text/javascript">
function OnFileUploadComplete(s, e) {
document.getElementById('image').src = e.callbackData;
}
</script>
<form id="form1" runat="server">
<div>
<dx:ASPxUploadControl ID="Upload" runat="server" ShowUploadButton="True" OnFileUploadComplete="Upload_FileUploadComplete">
<ValidationSettings AllowedFileExtensions=".jpg,.jpeg,.jpe,.gif">
</ValidationSettings>
<ClientSideEvents FileUploadComplete="OnFileUploadComplete" />
</dx:ASPxUploadControl>
<br />
<img src="Images/DefaultImage.jpg" id="image" alt="Please load image" />
</div>
</form>
protected void Upload_FileUploadComplete(object sender, FileUploadCompleteEventArgs e)
{
e.CallbackData = String.Format("Images\\Picture{0}.jpg", DateTime.Now.ToString("yyyy-MM-dd hh-mm-ss"));
string path = Page.MapPath("~/") + e.CallbackData;
e.UploadedFile.SaveAs(path);
}
Related GitHub Examples
The following code snippets (auto-collected from DevExpress Examples) contain references to the CallbackData property.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.