Control Silverlight Upload with Javascript

7 posts, 2 answers
  1. Justin McMillen
    Justin McMillen avatar
    20 posts
    Member since:
    Aug 2009

    Posted 03 Sep 2009 Link to this post

    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.
  2. Answer
    Miroslav
    Admin
    Miroslav avatar
    922 posts

    Posted 04 Sep 2009 Link to this post

    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.
  3. DevCraft banner
  4. Justin McMillen
    Justin McMillen avatar
    20 posts
    Member since:
    Aug 2009

    Posted 04 Sep 2009 Link to this post

    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?


  5. Valentin.Stoychev
    Admin
    Valentin.Stoychev avatar
    2198 posts

    Posted 07 Sep 2009 Link to this post

    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.
  6. Justin McMillen
    Justin McMillen avatar
    20 posts
    Member since:
    Aug 2009

    Posted 08 Sep 2009 Link to this post

    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?
  7. Answer
    Dimitrina
    Admin
    Dimitrina avatar
    442 posts

    Posted 11 Sep 2009 Link to this post

    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.
  8. Justin McMillen
    Justin McMillen avatar
    20 posts
    Member since:
    Aug 2009

    Posted 11 Sep 2009 Link to this post

    This is a great help.

    Thanks.
Back to Top
DevCraft banner