View Full Version : سوال: بهترین انتخاب برای نمایش پارشال ویو
helpsos
شنبه 27 اردیبهشت 1393, 18:36 عصر
با سلام
می خواستم بدونم که چه زمانی باید از هر کدام از گزینه های زیر استفاده نمود؟
1- @Html.Partial
2- @Html.RenderPartial
3- @Html.Action
4- @{Html.RenderAction
cancerr
شنبه 27 اردیبهشت 1393, 18:48 عصر
من همیشه از این استفاده می کنم خیلی دقیق هست همیشه هم چون آدرس کامل میگیره درسته
@RenderPage("~/Views/Shared/footer.cshtml")
rezaei_y
شنبه 27 اردیبهشت 1393, 21:58 عصر
توی codeproject مطلی زیر رو آورده :
codeproject (http://www.codeproject.com/Tips/617361/Partial-View-in-ASP-NET-MVC)
We can call the partial view in a normal view like:
Html.RenderPartial("~/Views/Shared/_Product.cshtml", product);
Or
@Html.Partial("~/Views/Shared/_Product.cshtml", product);
Html.Partial returns a string, Html.RenderPartial calls Write internally, and returns void.
You can store the output of Html.Partial in a variable, or return it from a function.
You cannot do this with Html.RenderPartial because the result will be written to the Response stream during execution.
So @html.RenderPartial() has faster execution than @html.Partial() due to RenderPartial giving quick
response to the output.
vBulletin® v4.2.5, Copyright ©2000-1404, Jelsoft Enterprises Ltd.