Freigeben über


RenderPartialExtensions.RenderPartial Method

Include Protected Members
Include Inherited Members

Renders the specified partial-view control.

This member is overloaded. For complete information about this member, including syntax, usage, and examples, click a name in the overload list.

Overload List

  Name Description
Public methodStatic member RenderPartial(HtmlHelper, String) Renders the specified partial view by using the specified HMTL helper.
Public methodStatic member RenderPartial(HtmlHelper, String, Object) Renders the specified partial view, passing it a copy of the current ViewDataDictionary object, but with the Model property set to the specified model.
Public methodStatic member RenderPartial(HtmlHelper, String, ViewDataDictionary) Renders the specified partial view, replacing its ViewData property with the specified ViewDataDictionary object.
Public methodStatic member RenderPartial(HtmlHelper, String, Object, ViewDataDictionary) Renders the specified partial view, replacing the partial view's ViewData property with the specified ViewDataDictionary object and setting the Model property of the view data to the specified model.

Top

Remarks

The RenderPartial method renders an ASP.NET user control (.ascx file) as a partial view.

When a partial view is instantiated, it gets its own copy of the ViewDataDictionary object that is available to the parent view. Therefore, the partial view has access to the data of the parent view. However, if the partial view updates the data, those updates affect only the partial view's ViewData object. The parent view's data is not changed.

See Also

Reference

RenderPartialExtensions Class

System.Web.Mvc.Html Namespace