Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

RenderPartialExtensions.RenderPartial Method

 

Renders the specified partial-view control.

Namespace:   System.Web.Mvc.Html
Assembly:  System.Web.Mvc (in System.Web.Mvc.dll)

NameDescription
System_CAPS_pubmethodSystem_CAPS_staticRenderPartial(HtmlHelper, String)

Renders the specified partial view by using the specified HTML helper.

System_CAPS_pubmethodSystem_CAPS_staticRenderPartial(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.

System_CAPS_pubmethodSystem_CAPS_staticRenderPartial(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.

System_CAPS_pubmethodSystem_CAPS_staticRenderPartial(HtmlHelper, String, ViewDataDictionary)

Renders the specified partial view, replacing its ViewData property with the specified ViewDataDictionary object.

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.

Return to top

RenderPartialExtensions.RenderPartial Method (HtmlHelper, String)

Renders the specified partial view by using the specified HTML helper.

public static void RenderPartial(
	this HtmlHelper htmlHelper,
	string partialViewName
)

Parameters

htmlHelper
Type: System.Web.Mvc.HtmlHelper

The HTML helper.

partialViewName
Type: System.String

The name of the partial view

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.

Return to top

RenderPartialExtensions.RenderPartial Method (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 static void RenderPartial(
	this HtmlHelper htmlHelper,
	string partialViewName,
	object model
)

Parameters

htmlHelper
Type: System.Web.Mvc.HtmlHelper

The HTML helper.

partialViewName
Type: System.String

The name of the partial view.

model
Type: System.Object

The model.

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.

Return to top

RenderPartialExtensions.RenderPartial Method (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.

public static void RenderPartial(
	this HtmlHelper htmlHelper,
	string partialViewName,
	object model,
	ViewDataDictionary viewData
)

Parameters

htmlHelper
Type: System.Web.Mvc.HtmlHelper

The HTML helper.

partialViewName
Type: System.String

The name of the partial view.

model
Type: System.Object

The model for the partial view.

viewData
Type: System.Web.Mvc.ViewDataDictionary

The view data for the partial view.

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.

Return to top

RenderPartialExtensions.RenderPartial Method (HtmlHelper, String, ViewDataDictionary)

Renders the specified partial view, replacing its ViewData property with the specified ViewDataDictionary object.

public static void RenderPartial(
	this HtmlHelper htmlHelper,
	string partialViewName,
	ViewDataDictionary viewData
)

Parameters

htmlHelper
Type: System.Web.Mvc.HtmlHelper

The HTML helper.

partialViewName
Type: System.String

The name of the partial view.

viewData
Type: System.Web.Mvc.ViewDataDictionary

The view data.

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.

Return to top
Show:
© 2015 Microsoft