Fornisce supporto per il rendering di una visualizzazione parziale.
System.Web.Mvc.Html.RenderPartialExtensions
Spazio dei nomi: System.Web.Mvc.Html
Assembly: System.Web.Mvc (in System.Web.Mvc.dll)
<ExtensionAttribute> _ Public NotInheritable Class RenderPartialExtensions
Non è necessario dichiarare un'istanza di una classe statica per accedere ai relativi membri.
public static class RenderPartialExtensions
[ExtensionAttribute] public ref class RenderPartialExtensions abstract sealed
public final class RenderPartialExtensions
| Nome | Descrizione | |
|---|---|---|
|
RenderPartial(HtmlHelper, String) | Esegue il rendering della visualizzazione parziale specificata utilizzando l'helper HTML specificato. |
|
RenderPartial(HtmlHelper, String, Object) | Esegue il rendering della visualizzazione parziale specificata, passandone una copia dell'oggetto ViewDataDictionary corrente, ma con la proprietà Model impostata sul modello specificato. |
|
RenderPartial(HtmlHelper, String, ViewDataDictionary) | Esegue il rendering della visualizzazione parziale specificata, sostituendo la relativa proprietà ViewData con l'oggetto ViewDataDictionary specificato. |
|
RenderPartial(HtmlHelper, String, Object, ViewDataDictionary) | Esegue il rendering della visualizzazione parziale specificata, sostituendo la proprietà ViewData della visualizzazione parziale con l'oggetto ViewDataDictionary specificato e impostando la proprietà Model dei dati di visualizzazione sul modello specificato. |
The RenderPartialExtensions class contains methods that extend the HtmlHelper class. The RenderPartial method renders an ASP.NET user control (.ascx file) as a partial view.
The following example shows how to create a partial view as a user control (.ascx file). The control displays the date and time strings that are passed in the ViewDataDictionary object. The control also calls the ActionLink helper method to refresh the date and time.
In the following example, the Index action method initializes the date and time strings and renders the Index view.
The following Index view shows how to use the RenderPartial helper method to display the partial view within its parent view. Unlike other HTML helper methods, a call to the RenderPartial method is enclosed in <% %> characters instead of <%= %> characters. This is because the RenderPartial method renders directly to the output stream. In contrast, most other helper methods return a string.