RadControls version |
Telerik.Web.UI 2007.3.12.18+
or
RadUpload v2.1.1+
|
.NET version |
NET 2.x/3.x
|
Visual Studio version |
2005/2008
|
programming language |
JavaScript, C#
|
browser support |
all browsers supported by r.a.d.controls
|
PROJECT DESCRIPTION
This project demonstrates a way to validate extensions client-side for each file input in RadUpload and place an * sign next to those file inputs where the selected files have forbidden extensions.
We use RadUpload's OnClientAdded event to add a hidden span with the * sign right next to every file input in RadUpload.
IMPORTANT NOTE: In order to ensure the proper operation of the event handler in all browsers you must declare the function before the RadUpload declaration!
The validation is done by integrating the RadUpload with a CustomValidator which will prevent the page from submitting when there are selected files with invalid extensions.
IMPORTANT NOTE: The ControlToValidate property of the CustomValidator must not be set!
In the custom validator's ClientValidationFunction we iterate through all file inputs and check whether the selected file has a in/valid extension and show/hide the * sign for the given file input row correspondingly. According to the result of the validation we set the IsValid property of the event arguments.
For versions Q1 2011 SP2(2011.1.519.35) + , please use the updated archive.