Tuesday, 26 May 2015

Partial view in Asp.Net MVC

5/26/2015 - By Pranav Singh 0

This article will explain you about partial view in mvc. In this article I will explain you about partial view and how you use the partial view in asp.net mvc application.

Now I will explain you what is partial view.

“In asp.nte mvc partial view acts as container which we can display on conditional bases. So in mvc there are four ways by which we can access the partial view”.

1.       Html.RenderPartial
2.       Html.Partial
3.       Html.RenderAction
4.       Html.Action

Html.RenderAction :  
1.       Return Type of renderpartial is void type.
2.       Simple to use no need to create action method.
3.       Renderpartial view is useful when the display data in partial view is already in the corresponding view model.

@Html.RenderPartial("User_View","Home")

Html.Partial:
1.       Return type of partial is string type
2.       Like render partial method partial view is also useful when the display data in partial view is already in the corresponding view model.

@Html.Partial("User_View")

Html.RenderAction
Render action method is useful when the display data in thee partial view is independent from corresponding view model.

@Html.RenderAction("User_View",)

Html.Action
Action method is useful when the display data in thee partial view is independent from corresponding view model.

@Html.Action("User_View")

Now we will see difference between Renderpartial and partial view.

Render Partial
Partial
Its return type is void
It’s return type is void
 We can’t store the output of the render partial view in cache, because the result will write to response stream during execution.
We can store the output of partial in cache.
It is faster then partial
It is less fast than render partial.


About the Author

We are the group of people who are expertise in different Microsoft technology like Asp.Net,MVC,C#.Net,VB.Net,Windows Application,WPF,jQuery,Javascript,HTML. This blog is designed to share the knowledge.

Get Updates

Subscribe to our e-mail newsletter to receive updates.

Share This Post

0 comments:

Please let me know your view

Free Ebooks


About Us

We are the group of people who are expertise in different Microsoft technology like Asp.Net,MVC,C#.Net,VB.Net,Windows Application,WPF,jQuery,Javascript,HTML. This blog is designed to share the knowledge.

Contact Us

For writing article in this website please send request by your

GMAIL ID: dotnetpools@gmail.com

Bugs and Suggestions

As we all know that this website is for sharing knowledge and providing proper solution. So while reading the article is you find any bug or if you have any suggestion please mail us at contact@aspdotnet-pools.com.

Partners


Global Classified : Connectseekers.com
© 2014 aspdotnet-pools.com Designed by Bloggertheme9.
back to top