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.
Some of my previous
articles are as follows: Ajax
Call Using UpdatePanel Display Data On Button Click Without Refresh In Asp.Net,
C#, Call
C# Code or Function or Method From Javascript In Asp.Net, Get
All Checked Checkbox Value Using jQuery in Asp.Net CheckBoxList, Get
RadioButton Value Using jQuery In Asp.Net.
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
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.
|
0 comments:
Please let me know your view