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

Multi file rad Uploade

5 Answers 132 Views
Upload (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Ted Bielenda
Top achievements
Rank 1
Ted Bielenda asked on 05 Jul 2010, 04:09 PM
Hi,

     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

Sort by
0
Genady Sergeev
Telerik team
answered on 06 Jul 2010, 09:57 AM
Hi Ted Bielenda,

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
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Ted Bielenda
Top achievements
Rank 1
answered on 06 Jul 2010, 10:55 AM
when i am using these started and finished functions i am getting the error like following


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






0
Genady Sergeev
Telerik team
answered on 06 Jul 2010, 05:10 PM
Hello Ted Bielenda,

You can find sample project demonstrating the approach as an attachment.

Greetings,
Genady Sergeev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Ted Bielenda
Top achievements
Rank 1
answered on 07 Jul 2010, 07:41 AM
Hi Genady Sergeev,

                         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,
0
Genady Sergeev
Telerik team
answered on 09 Jul 2010, 02:15 PM
Hello Ted Bielenda,

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
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Upload (Obsolete)
Asked by
Ted Bielenda
Top achievements
Rank 1
Answers by
Genady Sergeev
Telerik team
Ted Bielenda
Top achievements
Rank 1
Share this question
or