0

I have downloaded jQuery Fiel upload plugin from NuGet pakages in VS2013. By default there is a sample code generated with controller and views , This code and plugin works fine in the sample and in other views but when I try using the same code in Partial View the plugin doesn't work. I have very little knowledge in jQuery and AJAX. Need help to get it working with partial views.

2
  • Have you included a reference to the script file inside the view that contains the partial view? Commented Jan 8, 2014 at 22:46
  • did you get it working.having same issue Commented Aug 11, 2016 at 12:53

2 Answers 2

1

Try to initialize fileupload in Partial View again. Its help to me. $(elem).fileupload({ ....});

Sign up to request clarification or add additional context in comments.

Comments

0

I'm thinking that you might be missing a reference to the plugin script within your page.

Somewhere on your parent view or partial view you should include a reference as such:

<script src="js/jquery.fileupload.js"></script>

Of course the path and file name should be the ones you have in your project.

Hope this helps.

For further reading on how to include scripts in HTML you can check:

http://www.w3schools.com/js/js_howto.asp

9 Comments

I have added the scripts. And its not working. If I just copy paste the same code in a main view I get it working fine but why not in partial view?. :(
@Reddy could you post both view codes? i.e. the one that works fine and the one that has the partial view that doesn't work?
There is nothing wrong with the code. The only thing I feel is there is some changes needed to be made in the plugin to be used in partial view. I am looking for that.
How are you rendering your Partial View? Are you doing it through AJAX? If so, you will need to rebind the plugin to your upload button/link within the success callback in order for it to work again. If not, it will be interpreted as a simple button or link.
I am using MVC Razor syntax @Html.RenderPartial("PartialViewName") to call my pratial view. Actually the View name is dynamically created by HtmlHelper classes. But at the end of the day its all the same.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.