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

Does RadUpload Control Supports MVVM

5 Answers 88 Views
Upload
This is a migrated thread and some comments may be shown as answers.
Paulin
Top achievements
Rank 1
Paulin asked on 11 Sep 2011, 12:49 PM

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.

5 Answers, 1 is accepted

Sort by
0
Petar Mladenov
Telerik team
answered on 14 Sep 2011, 04:43 PM
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 >>

0
Dharmesh Trivedi
Top achievements
Rank 1
answered on 07 Oct 2011, 06:12 PM
Can you please point at an example of RadUpload and MVVM. Thank You
0
Petar Mladenov
Telerik team
answered on 12 Oct 2011, 02:39 PM
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 >>

0
Dharmesh Trivedi
Top achievements
Rank 1
answered on 13 Oct 2011, 04:59 PM
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,
0
Tina Stancheva
Telerik team
answered on 18 Oct 2011, 12:14 PM
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 >>

Tags
Upload
Asked by
Paulin
Top achievements
Rank 1
Answers by
Petar Mladenov
Telerik team
Dharmesh Trivedi
Top achievements
Rank 1
Tina Stancheva
Telerik team
Share this question
or