I am using Silverlight Red Upload for multifile uploading in my asp.net web site. And i wants if a user will uploade any file in control the page will busy and user will not able to click any control at same time, Is there any possiblity plese let me know.
I am using the control a following...
<
object id="SilverlightUpload" data="data:application/x-silverlight," type="application/x-silverlight-2"
width="100%" height="120px">
<param name="source" value='<%= ResolveUrl("~/Upload.xap") %>' />
<param name="background" value="white" />
<param name="minRuntimeVersion" value="2.0.31005.0" />
<param name="autoUpgrade" value="true" />
<param name="windowless" value="true" />
<param name="InitParams" value='<%= InitParameters %>' />
<a href="http://go.microsoft.com/fwlink/?LinkID=124807" style="text-decoration: none;">
<img src="http://go.microsoft.com/fwlink/?LinkId=108181" alt="Get Microsoft Silverlight"
style="border-style: none" />
</a>
<telerik1:RadUpload ID="RadUpload1" runat="server">
</telerik1:RadUpload>
</object>
Thanks,
5 Answers, 1 is accepted
You can hook on the OnClientFilesUploadStarted event provided by the Silverlight upload and then use a plug-in like jquery block to block the page. Then you can use the OnClientUploadFilesUploadFinished event to enable the page.
You can add handlers for the upper-mentioned events the following way:
uploadConfig.Add("OnClientFilesUploadStarted=" + "onClientUploadStarted");
uploadConfig.Add(
"OnClientFilesUploadFinished="
+
"onClientUploadFinished"
);
Where the left param is the name of the event and the right is the name of the client-side handler.
Regards,
Genady Sergeev
the Telerik team
Microsoft JScript runtime error: Unhandled Error in Silverlight 2 Application [Arg_NullReferenceException]
Arguments:
Debugging resource strings are unavailable. Often the key and arguments provide sufficient information to diagnose the problem. See http://go.microsoft.com/fwlink/?linkid=106663&Version=4.0.50524.0&File=mscorlib.dll&Key=Arg_NullReferenceException at Upload.Page.InvokeScriptObject(String functionName, Object[] args)
at Upload.Page.RadUpload_UploadStarted(Object sender, UploadStartedEventArgs e)
at Telerik.Windows.Controls.RadUpload.StartUpload()
at Telerik.Windows.Controls.RadUpload.UploadButton_Click(Object sender, EventArgs e)
at System.Windows.Controls.Primitives.ButtonBase.OnClick()
at System.Windows.Controls.Button.OnClick()
at System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs e)
at System.Windows.Controls.Control.OnMouseLeftButtonUp(Control ctrl, EventArgs e)
at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, String eventName)
and my file uploader is not working. Please provide me any sample.
is any way to resolve it.
Thanks
You can find sample project demonstrating the approach as an attachment.
Greetings,
Genady Sergeev
the Telerik team
Thanks for sample,It is working, But I need same functionality with delete file options as mentioned in the attached image. And if i am using delete file option code like this javascript function, It is giving me java script error in IE and saying for debugging.
// Fired when a file is uploaded
function onClientFileUploaded(json) {
$get("<%=btnUpload.ClientID %>").disabled = "disabled";
var uploadedFile = Sys.Serialization.JavaScriptSerializer.deserialize(json);
var downloadFile = $("<a class='download-file'></a>")
.attr("href", '<%= ResolveUrl(TargetFolder) %>' + uploadedFile.FileName)
.text(uploadedFile.FileName);
var deleteFile = $("<a class='delete-file'>Delete</a>")
.attr("href", "#")
.click(function(e) {
e.preventDefault();
Array.remove(uploadedFiles, uploadedFile);
updateHiddenField();
PageMethods.DeleteFile(uploadedFile.FileName);
$(this)
.parent()
.animate({ width: 0, opacity: 0 }, function() {
$(this).remove()
});
}
);
$("<span class='uploaded-file'></span>")
.append(downloadFile)
.append(deleteFile)
.appendTo($("div.uploaded-files"));
Array.add(uploadedFiles, uploadedFile);
}
Thanks,
Thank you for the sample project. On my machine, it failed at this line:
updateHiddenField();
After I've added that function everything worked as expected. Could you please adding the following to your aspx page:
function
updateHiddenField() {
var
json = Sys.Serialization.JavaScriptSerializer.serialize(uploadedFiles);
$get(
'UploadedFilesJson'
).value = json;
}
Regards,
Genady Sergeev
the Telerik team