12 Answers, 1 is accepted
0
Shinu
Top achievements
Rank 2
answered on 23 Aug 2013, 04:11 AM
Hi Carlos,
Please try the following Code Snippet that I have tried which works fine at my end.
ASPX:
JavaScript:
Thanks,
Shinu.
Please try the following Code Snippet that I have tried which works fine at my end.
ASPX:
<
telerik:RadAsyncUpload
ID
=
"RadAsyncUpload1"
runat
=
"server"
AllowedFileExtensions
=
".jpg,.png"
OnClientValidationFailed
=
"OnClientValidationFailed1"
>
</
telerik:RadAsyncUpload
>
JavaScript:
<script type=
"text/javascript"
>
function
OnClientValidationFailed1(sender, args) {
$telerik.$(
".ruCancel"
).parent().remove();
alert(
"Allowed files extension are .jpg, .png"
);
}
</script>
Thanks,
Shinu.
0
Carlos
Top achievements
Rank 1
answered on 23 Aug 2013, 08:42 AM
Hi all, Thansk
and in C#.
Regards.
and in C#.
Regards.
0
Carlos
Top achievements
Rank 1
answered on 23 Aug 2013, 03:41 PM
Tnaks Shinu,
it does thje trick exept for que java script, i prefered in c#, but not all my problem are resolved the control hides itself after given the error it there a way only to reset it to the select file??
Tanks and Regards
it does thje trick exept for que java script, i prefered in c#, but not all my problem are resolved the control hides itself after given the error it there a way only to reset it to the select file??
Tanks and Regards
0
Shinu
Top achievements
Rank 2
answered on 26 Aug 2013, 12:22 PM
Hi Carlos,
You can try the following JavaScript to prevent resetting the control if the selected files contain an invalid file.
JavaScript:
Thanks,
Shinu.
You can try the following JavaScript to prevent resetting the control if the selected files contain an invalid file.
JavaScript:
<script type=
"text/javascript"
>
function
OnClientValidationFailed(sender, args) {
$telerik.$(args.get_row()).css(
"display"
,
"none"
);
alert(
"Allowed files extension is .jpg, .png"
);
}
</script>
Thanks,
Shinu.
0
Carlos
Top achievements
Rank 1
answered on 26 Aug 2013, 02:08 PM
Hi and thanks,
What i want to do its resetting, clean the file if its not the one.
Best regards
What i want to do its resetting, clean the file if its not the one.
Best regards
0
Shinu
Top achievements
Rank 2
answered on 27 Aug 2013, 05:04 AM
Hi Carlos,
I am not sure about your requirement. I guess you don't want to show the invalid file from the selected files while uploading.The OnClientValidationFailed event will fire whenever an invalid file is selected to upload.
ASPX:
JavaScript:
So the above approach will not let the user upload an invalid file and show that file name while uploading. Can you please elaborate the issue.
Thanks,
Shinu
I am not sure about your requirement. I guess you don't want to show the invalid file from the selected files while uploading.The OnClientValidationFailed event will fire whenever an invalid file is selected to upload.
ASPX:
<
telerik:RadAsyncUpload
ID
=
"RadAsyncUpload1"
runat
=
"server"
AllowedFileExtensions
=
".jpg,.png"
OnClientValidationFailed
=
"OnClientValidationFailed1"
>
</
telerik:RadAsyncUpload
>
JavaScript:
<script type=
"text/javascript"
>
function
OnClientValidationFailed1(sender, args) {
$telerik.$(args.get_row()).empty();
// to hide the invalid file from displaying.
//OR
$telerik.$(args.get_row()).css(
"display"
,
"none"
);
//to hide the invalid file from displaying.
alert(
"Allowed files extension are .jpg, .png"
);
//to show an alert if invalid file is selected to upload.
}
</script
So the above approach will not let the user upload an invalid file and show that file name while uploading. Can you please elaborate the issue.
Thanks,
Shinu
0
Carlos
Top achievements
Rank 1
answered on 27 Aug 2013, 10:45 AM
Hi and thanks,
What i need its to automatacly remove the invalid file from the list, and the select file option to be showned.
Best Regards
What i need its to automatacly remove the invalid file from the list, and the select file option to be showned.
Best Regards
0
Shinu
Top achievements
Rank 2
answered on 28 Aug 2013, 05:53 AM
Hi Carlos,
When you are selecting multiple files and If the selected files contains an invalid file, that invalid file also will be listed in the controls uploaded files with a red mark which is the default behavior but internally the valid files are only uploaded to the Temporary Folder and available for upload on the server. In my code what I am doing is I am programmatically removing the invalid file name displayed along with the uploaded files list and displaying an alert. Please elaborate on what you mean by "automatically remove the invalid file". Please note when you are using RadAsyncUpload you cannot programmatically open the "Open File" window. (e.g. when RadAsyncUpload uses a SIlverlight module, the control uses the silverlight object)
Thanks,
Shinu.
When you are selecting multiple files and If the selected files contains an invalid file, that invalid file also will be listed in the controls uploaded files with a red mark which is the default behavior but internally the valid files are only uploaded to the Temporary Folder and available for upload on the server. In my code what I am doing is I am programmatically removing the invalid file name displayed along with the uploaded files list and displaying an alert. Please elaborate on what you mean by "automatically remove the invalid file". Please note when you are using RadAsyncUpload you cannot programmatically open the "Open File" window. (e.g. when RadAsyncUpload uses a SIlverlight module, the control uses the silverlight object)
Thanks,
Shinu.
0
Carlos
Top achievements
Rank 1
answered on 28 Aug 2013, 08:33 AM
Hi,
I tried you code but the behavior isnt onlçy removing the invalid file also removes de textbox and buton of the select file instruction.
Thanks
I tried you code but the behavior isnt onlçy removing the invalid file also removes de textbox and buton of the select file instruction.
Thanks
0
Carlos
Top achievements
Rank 1
answered on 02 Sep 2013, 10:37 AM
isn't there a solution
0
Sharjeel
Top achievements
Rank 1
answered on 24 Sep 2014, 11:22 AM
Hi guys,
same problem here i don't want to show invalid files in list, and I use the following code
function validationFailed(radAsyncUpload, args) {
var $ = $telerik.$;
var $row = $(args.get_row());
$telerik.$(".ruCancel").parent().remove();
}
it removes the invalid file message from list but the problem is after reaching its total file count, it hides selection button and the valid files in list is none, so how we tackle show selection button after valid files reach to total count
same problem here i don't want to show invalid files in list, and I use the following code
function validationFailed(radAsyncUpload, args) {
var $ = $telerik.$;
var $row = $(args.get_row());
$telerik.$(".ruCancel").parent().remove();
}
it removes the invalid file message from list but the problem is after reaching its total file count, it hides selection button and the valid files in list is none, so how we tackle show selection button after valid files reach to total count
0
Hello,
You can also remove the failed validation files with jQuery as in the code below:
Hope this will be helpful.
Regards,
Boyan Dimitrov
Telerik
You can also remove the failed validation files with jQuery as in the code below:
function
validationFailed(sender, eventArgs) {
sender._updateCancelButton(eventArgs.get_row());
$telerik.$(
".ruRemove"
, eventArgs.get_row()).click();
}
Hope this will be helpful.
Regards,
Boyan Dimitrov
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.