This example demonstrates how to display an error icon if no file is selected.
The main idea is to call the upload control's client-side GetText method to get the selected file's name. If no file is selected, the upload control displays an error icon.
function OnClick(s, e) {
var isValid = uploadControl.GetText() != "";
img.SetVisible(!isValid);
if (isValid)
uploadControl.Upload();
}
<dx:ASPxUploadControl ID="upload" runat="server" ClientInstanceName="uploadControl" ... />
<dx:ASPxImage ID="imgErrorIcon" runat="server" ClientInstanceName="img" ClientVisible="False" />
<dx:ASPxButton ID="btnCheck" runat="server" AutoPostBack="false" >
<ClientSideEvents Click="OnClick" />
</dx:ASPxButton>
- Default.aspx (VB: Default.aspx)
- Default.aspx.cs (VB: Default.aspx.vb)