Does RadUpload Control Supports MVVM

6 posts, 0 answers
  1. Paulin
    Paulin avatar
    1 posts
    Member since:
    Aug 2011

    Posted 11 Sep 2011 Link to this post

    Hi,

    We are using MVVM approach. I'm finding difficulty in implementing the MVVM approach to RadUpload control. I am able to clear the text boxes by setting null to the property.I have no idea how to achieve that for RadUpload.I want to clear the selected items and the progress bar using MVVM . Can you please help me to achieve.

  2. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 14 Sep 2011 Link to this post

    Hello Paulin,

     Currently, the cancelation of the SelectedItems in the RadUpload cannot be achieved in a MVVM scenario. You can use the Clear() method of the Selectedtems collection in code behind like so:

    this.RadUpload1.SelectedItems.Clear();
    Please let us know if you need further assistance. Best wishes,
    Petar Mladenov
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  3. DevCraft banner
  4. Dharmesh Trivedi
    Dharmesh Trivedi avatar
    24 posts
    Member since:
    Oct 2009

    Posted 07 Oct 2011 Link to this post

    Can you please point at an example of RadUpload and MVVM. Thank You
  5. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 12 Oct 2011 Link to this post

    Hello Dharmesh Trivedi,

     You cannot achieve much with the RadUpload in an MVVM way. You can explore this forum thread(there is a project attached) where its is shown how to bind the RadUpload.CanceCommand.  Please elaborate more on your scenario and especially what you need to do in an MVVM way. We would be glad to advice you.

    Best wishes,
    Petar Mladenov
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  6. Dharmesh Trivedi
    Dharmesh Trivedi avatar
    24 posts
    Member since:
    Oct 2009

    Posted 13 Oct 2011 Link to this post

    this is what I want to do in RadUpload fileuploadingstarting event

    (1) Upload the new file to Current Item on the screen - Store in List<bytes[]>
    (2) To do that I have to get reference to viewmodel of the current screen (dont like referencing viewmodel in view) - getting DataContext of the viewmodel
    (3) Save the file being uploaded currently selected item (one of the property of the viewmodel)

    is there a workaround for this.. so I don't reference my viewmodel in the code behind?

    Please advise

    Thank You,
  7. Tina Stancheva
    Admin
    Tina Stancheva avatar
    3298 posts

    Posted 18 Oct 2011 Link to this post

    Hi Dharmesh Trivedi,

    Do you need to save the files before uploading them? Because if you want to populate a view model with the byte stream of the uploaded files, you can customize the UploadHandler to save the uploaded files in a database and on the client-side use this database to populate a view model collection with the files.

    Here you can find more information on how to customize the UploadHandler to save the uploaded files in a database. Please let me know if this scenario will work for you.

    Regards,
    Tina Stancheva
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Back to Top
DevCraft banner