I’m using MVC3 razor and in Views folder I have 4 folder:
Shared
- _Layout.cshtml
Folder2
- Index.cshtml
- UploadFile.cshtml
the uploadFile is partial view for folder2s’ index.cshtml
Folder3
- Index.cshtml
- _list.cshtml
Folder4
- Index.cshtml
- _CreateFile.cshtml
I’m newbie in MVC3 so I haven’t difficult question
How I can use UploadFile.cshtml in _list.cshtml and _createFile.cshtml
I need the same function in other folders which is in UploadFile.cshtml
in UploadFile.cshtml I have
<script type="text/javascript">
function createUploader() {
var uploader = new qq.FileUploader({
element: document.getElementById('FileUploader'),
action: 'Chat/FileUpload',
debug: true
});
}
window.onload = createUploader;
</script>
<div id="FileUploader">
<noscript>
<p>Please enable JavaScript to use file uploader.</p>
</noscript>
</div>
and I want to use this uploader in different places not like @Html.Action
like @Html.Partial or somthing like this
You can make some Action in your Controller that returns your
UploadFilepartial view and then call it from anywhere like thisAlso note that it’s good practice to start names of partialv iews with underline like
_UploadFile. It makes your recources more visible to other people.Otherwise, if you don’t want action you can simply call your partial view with
Html.Partialmethod. I didn’t test it, but it should work