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.
I would appreciate if you lead me to the right way.
Thanks in advance!
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!