RadAsyncUpload Required Validator in RadGrid Template

2 posts, 0 answers
  1. İlter
    İlter avatar
    19 posts
    Member since:
    Feb 2013

    Posted 04 Apr 2013 Link to this post


    Before I begin, I want to say that I searched for this problem in the entire forum and googled it long in order to come up with a solution. But, no luck...

    May be the Telerik guys can help me with the problem.

    In the AsyncUpload - Binary Images And RadAsyncUpload in Grid demo, when I click on "Add New Record", then "Save" button, the validator for RadAsyncUpload control works. I click "Cancel", and then click on "Add New Record" again, there is no validator for AsyncUpload control anymore (validators for textboxes work OK). I tried that with the latest version 2013 Q1 and came up with the same result.

    What I Expected...

    I expected the RadAsnycUpload's custom validator to work as any other control validator (For textboxes, for example). No matter if I reload the page, or click Cancel to close the insert form, the error message should have appeared and prevented me closing the insert form.

    In my project, I am working on multiple RadAsyncUpload controls in the RadGrid EditTemplate. At least one for video file and another for cover pictures for that video file. When a user upload the video (that takes enough time to get angry if it's needed to be uploaded again) and click OK before uploading the image file, query doesn't work and insert form closes. I thought to prevent that with validator from client side, but as I mentioned, it's not working as I expected. May be that is something nobody thought would be important but in the sake of creating a good application, I would like to know if there is any way to make custom validator for asyncupload control work fine in a RadGrid template.

    The js code I used is the same with the demo codes, but I am pasting here anyway.

    <telerik:RadCodeBlock ID="RadCodeBlock2" runat="server">
        <script type="text/javascript">
            var uploadedFilesCount = 0;
            var isEditMode;
            function validateRadUpload(source, e) {
                // When the RadGrid is in Edit mode the user is not obliged to upload file.
                if (isEditMode == null || isEditMode == undefined) {
                    e.IsValid = false;
                    if (uploadedFilesCount > 0) {
                        e.IsValid = true;
                isEditMode = null;
            function OnClientFileUploaded(sender, eventArgs) {

    I would appreciate if you lead me to the right way.

    Thanks in advance!
  2. Hristo Valyavicharski
    Hristo Valyavicharski avatar
    975 posts

    Posted 09 Apr 2013 Link to this post

    Hi İlter,

    Thank you for pointing that out. Currently we are working to resolve the issue with the online demo. Meanwhile I'm attaching my modification of the code. Please find the attachment and check if it works properly at your end.

    Hristo Valyavicharski
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top