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

Control Silverlight Upload with Javascript

6 Answers 77 Views
Upload
This is a migrated thread and some comments may be shown as answers.
Justin McMillen
Top achievements
Rank 1
Justin McMillen asked on 03 Sep 2009, 03:02 PM
Hi,
  Is it possible to control the Silverlight file upload control with javascript?  I would like to be able to start the upload from javascript.  I also need to know when the control has finished uploading the files. 

Thanks.

6 Answers, 1 is accepted

Sort by
0
Accepted
Miroslav
Telerik team
answered on 04 Sep 2009, 06:26 AM
Hello Justin,

In Silverlight you can mark a class as ScriptableType and its members as ScriptableMember to indicate that it can be used from JavaScript. The RadUpload is marked with these attributes as well. The only thing you have to do is register an instance of the RadUpload with the HtmlPage.  The RadUpload should work as any other scriptable class. If you need, you can find many tutorials about Silverlight / JavaScript interop, here is one:

http://pietschsoft.com/post/2008/06/Silverlight-and-JavaScript-Interop-Basics.aspx

You can start the upload from JavaScript but the user needs to choose the files first as he would normally. There are two events that are raised on completion: FileUploaded and UploadFinished.

Greetings,
Miroslav
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Justin McMillen
Top achievements
Rank 1
answered on 04 Sep 2009, 05:26 PM
Hi Miroslav,

This works well.  Thanks.  I do have one other question, though.  Is it possible to hide the "Upload" button on the silverlight control?


0
Valentin.Stoychev
Telerik team
answered on 07 Sep 2009, 08:01 AM
Hello Justin McMillen,

You need to edit the style of the Upload and modify its control template.

Kind regards,
Valentin.Stoychev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Justin McMillen
Top achievements
Rank 1
answered on 08 Sep 2009, 03:31 PM
Thanks. 

I have downloaded the source code for the silverlight controls.  Where can I find the default style for the upload control's control template?
0
Accepted
Dimitrina
Telerik team
answered on 11 Sep 2009, 09:08 AM
Hello Justin McMillen,

You can see the template of RadUpload control, when you edit the control in  "Blend". For more information you can visit this link
http://www.telerik.com/help/silverlight/radcontrols-for-silverlight-expression-blend-support.html 

Please find your attached example.
If you have any question please do not hesitate to ask.

I hope this will help you.


All the best,
Dimitrina
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Justin McMillen
Top achievements
Rank 1
answered on 11 Sep 2009, 05:13 PM
This is a great help.

Thanks.
Tags
Upload
Asked by
Justin McMillen
Top achievements
Rank 1
Answers by
Miroslav
Telerik team
Justin McMillen
Top achievements
Rank 1
Valentin.Stoychev
Telerik team
Dimitrina
Telerik team
Share this question
or