Selain tipe yang dikembalikan dan fakta bahwa Anda menyebutnya berbeda tentu saja
<% Html.RenderPartial(...); %>
<%= Html.Partial(...) %>
Jika mereka berbeda, mengapa Anda memanggil satu daripada yang lain?
Definisi:
// Type: System.Web.Mvc.Html.RenderPartialExtensions
// Assembly: System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
// Assembly location: C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET MVC 2\Assemblies\System.Web.Mvc.dll
using System.Web.Mvc;
namespace System.Web.Mvc.Html
{
public static class RenderPartialExtensions
{
public static void RenderPartial(this HtmlHelper htmlHelper, string partialViewName);
public static void RenderPartial(this HtmlHelper htmlHelper, string partialViewName, ViewDataDictionary viewData);
public static void RenderPartial(this HtmlHelper htmlHelper, string partialViewName, object model);
public static void RenderPartial(this HtmlHelper htmlHelper, string partialViewName, object model,
ViewDataDictionary viewData);
}
}
// Type: System.Web.Mvc.Html.PartialExtensions
// Assembly: System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
// Assembly location: C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET MVC 2\Assemblies\System.Web.Mvc.dll
using System.Web.Mvc;
namespace System.Web.Mvc.Html
{
public static class PartialExtensions
{
public static MvcHtmlString Partial(this HtmlHelper htmlHelper, string partialViewName);
public static MvcHtmlString Partial(this HtmlHelper htmlHelper, string partialViewName,
ViewDataDictionary viewData);
public static MvcHtmlString Partial(this HtmlHelper htmlHelper, string partialViewName, object model);
public static MvcHtmlString Partial(this HtmlHelper htmlHelper, string partialViewName, object model,
ViewDataDictionary viewData);
}
}
asp.net
asp.net-mvc-2
Stéphane
sumber
sumber
Ini adalah penjelasan yang bagus oleh Dino Esposito:
sumber