I'm have created a custom validator for the RadAsyncUpload control on my form however I'm getting a javascript error that the getUploadedFiles() method doesn't exist for this object. Below is the code I've used
I'm using the Telerik RadControls for ASP.NET AJAX Q2 2010
Regards,
Victor
<
asp:CustomValidator
ID
=
"rfvFileUpload"
ClientValidationFunction
=
"validateFileUpload"
runat
=
"server"
ErrorMessage
=
"File Required"
/>
function
validateFileUpload(sender, args) {
var
uploadObject = $find(
"<%= RadAsyncUpload1.ClientID %>"
);
args.IsValid = uploadObject.getUploadedFiles().length != 0;
}
I'm using the Telerik RadControls for ASP.NET AJAX Q2 2010
Regards,
Victor
6 Answers, 1 is accepted
0
Hello support,
We have added the getUploadedFiles method for the Q3 release of RadAsyncUpload. Should you need to use it with earlier versions, you can add it to the RadAsyncUpload using the following code:
place that code after the ScriptManager declaration.
Kind regards,
Genady Sergeev
the Telerik team
We have added the getUploadedFiles method for the Q3 release of RadAsyncUpload. Should you need to use it with earlier versions, you can add it to the RadAsyncUpload using the following code:
Telerik.Web.UI.RadAsyncUpload.prototype.getUploadedFiles: function() {
var files = [];
$telerik.$(".ruUploadSuccess", this.get_element()).each(function(index, value) {
files[index] = value;
});
return files;
}
place that code after the ScriptManager declaration.
Kind regards,
Genady Sergeev
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0

support
Top achievements
Rank 1
answered on 11 Jan 2011, 02:59 AM
Thanks for the workaround but I'm not sure what you meant by placing the piece of code after the ScriptManager declaration.
Do you mean like this?
If so I'm getting a javascript error
Webpage error details
User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; Media Center PC 6.0; InfoPath.2; .NET CLR 1.1.4322; .NET4.0C; .NET4.0E)
Timestamp: Tue, 11 Jan 2011 01:58:15 UTC
Message: Expected ';'
Line: 73
Char: 61
Code: 0
URI: http://localhost:57445/intranet.UI/home.aspx
Regards,
Victor
Do you mean like this?
<
form
id
=
"form1"
runat
=
"server"
defaultbutton
=
"btnSearch"
>
<
telerik:RadScriptManager
ID
=
"RadScriptManager1"
runat
=
"server"
LoadScriptsBeforeUI
=
"true"
ScriptMode
=
"release"
EnablePartialRendering
=
"true"
/>
<
telerik:RadScriptBlock
ID
=
"RadScriptBlock1"
runat
=
"server"
>
<
script
type
=
"text/javascript"
>
Telerik.Web.UI.RadAsyncUpload.prototype.getUploadedFiles: function() {
var files = [];
$telerik.$(".ruUploadSuccess", this.get_element()).each(function(index, value) {
files[index] = value;
});
return files;
}
</
script
>
</
telerik:RadScriptBlock
>
If so I'm getting a javascript error
Webpage error details
User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; Media Center PC 6.0; InfoPath.2; .NET CLR 1.1.4322; .NET4.0C; .NET4.0E)
Timestamp: Tue, 11 Jan 2011 01:58:15 UTC
Message: Expected ';'
Line: 73
Char: 61
Code: 0
URI: http://localhost:57445/intranet.UI/home.aspx
Regards,
Victor
0
Accepted
Hello support,
Please excuse me, I've given you incorrect code. Here is the correct one:
Greetings,
Genady Sergeev
the Telerik team
<form id=
"form1"
runat=
"server"
defaultbutton=
"btnSearch"
>
<telerik:RadScriptManager ID=
"RadScriptManager1"
runat=
"server"
LoadScriptsBeforeUI=
"true"
ScriptMode=
"release"
EnablePartialRendering=
"true"
/>
<telerik:RadScriptBlock ID=
"RadScriptBlock1"
runat=
"server"
>
<script type=
"text/javascript"
>
Telerik.Web.UI.RadAsyncUpload.prototype.getUploadedFiles =
function
() {
var
files = [];
$telerik.$(
".ruUploadSuccess"
,
this
.get_element()).each(
function
(index, value) {
files[index] = value;
});
return
files;
}
</script>
</telerik:RadScriptBlock>
Please excuse me, I've given you incorrect code. Here is the correct one:
Greetings,
Genady Sergeev
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0

support
Top achievements
Rank 1
answered on 14 Jan 2011, 09:30 AM
I've got a slight problem but we're almost there. When my page loads the RadAsyncUpload control is invisible. The code snippet that you've provided requires the control to be visible otherwise it throws this error: 'Telerik.Web.UI.RadAsyncUpload.prototype' is null or not an object
0
Hello support,
Indeed, this is true, in order to add functions to the RadAsyncUpload prototype the latter should be visible on the page. Thank you for clarifying this.
All the best,
Genady Sergeev
the Telerik team
Indeed, this is true, in order to add functions to the RadAsyncUpload prototype the latter should be visible on the page. Thank you for clarifying this.
All the best,
Genady Sergeev
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0

support
Top achievements
Rank 1
answered on 18 Jan 2011, 02:35 AM
Thanks for the help Genady. I guess I'll have to find a work around in the UI design to allow the RadAsyncUpload control to be visible when the form is initially loaded.