HI Friends ,
At what situation Force us to use the Partial view .How to use that .Can Anyone Explain in detatils with example .
Thanks in Advance ,
If you are familiar with WebForms, you can come across the word like "User Controls". In ASP.Net MVC, the same concept called as "Partial Views". With the help of partial views you can achieve the concept of Reusabililty.
There are two reasons to use partial views:
- Reusability. If your view have some part in common, you can separate that part out in a partial view and then call the partial view from the other views directly or via an actionmethod.
- Partial update of page. If you know that a certain part of your view will be changing a lot, you can separate this part into a partial view. Then if you use Ajax only this part of the page will be updated.
Hope you get from this
- In a simple way partial views are used for reusable purpose.
- If you create a partial view in under views- particular view folder name, then you can use by that controller actions only.
- If you create a partial view in under views-> shared folder then it is global for all controllers.
- Another advantage by using Partial views you can update the partial view content by using an Ajax request.