Question

I am very new to asp.net MVC.

I need to create dnd file "component". It allows user to upload file to server using DnD, the upload is done via webAPI. I am using FileModel here, for example, webApi also returns FileModel (to show uploaded file info on page). I did this part.

However, I did it in the "TestView". I need ability to add this "component" to any view on my project. Unfourtunately I do not have knowledge enough to do this.

I have found out that there are PartialViews. Should I just move my "TestView" to some "FileUploadPartialView"? What problems this will cause? How this affect the usage of FileModel?

Was it helpful?

Solution

Partial Views are like a javascript include. You shouldn't have any trouble.

Just put this wherever you need to have your partial view...

@Html.Partial("_FileUploadPartialView")

Let me know if you need more detail.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top