This is a migrated thread and some comments may be shown as answers.

RadAsyncUpload Required Validator in RadGrid Template

1 Answer 79 Views
AsyncUpload
This is a migrated thread and some comments may be shown as answers.
İlter
Top achievements
Rank 1
İlter asked on 04 Apr 2013, 02:00 PM
Hi,

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) {
            uploadedFilesCount++;
        }
    </script>
</telerik:RadCodeBlock>

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

Thanks in advance!

1 Answer, 1 is accepted

Sort by
0
Hristo Valyavicharski
Telerik team
answered on 09 Apr 2013, 11:46 AM
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.

Regards,
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.
Tags
AsyncUpload
Asked by
İlter
Top achievements
Rank 1
Answers by
Hristo Valyavicharski
Telerik team
Share this question
or