RenderPartialExtensionsRenderPartial 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.

Namespace:   System.Web.Mvc.Html
Assembly:  System.Web.Mvc (in System.Web.Mvc.dll)
<[%$TOPIC/dd470561_en-us_VS_118_2_0_0_0_0%]> _
Public Shared Sub RenderPartial ( _
	htmlHelper As [%$TOPIC/dd470561_en-us_VS_118_2_0_0_0_1%], _
	partialViewName As [%$TOPIC/dd470561_en-us_VS_118_2_0_0_0_2%], _
	model As [%$TOPIC/dd470561_en-us_VS_118_2_0_0_0_3%], _
	viewData As [%$TOPIC/dd470561_en-us_VS_118_2_0_0_0_4%] _
)
Dim htmlHelper As [%$TOPIC/dd470561_en-us_VS_118_2_0_1_0_0%] 
Dim partialViewName As [%$TOPIC/dd470561_en-us_VS_118_2_0_1_0_1%] 
Dim model As [%$TOPIC/dd470561_en-us_VS_118_2_0_1_0_2%] 
Dim viewData As [%$TOPIC/dd470561_en-us_VS_118_2_0_1_0_3%] 

htmlHelper.RenderPartial(partialViewName, _
	model, viewData)
public static void RenderPartial(
	this [%$TOPIC/dd470561_en-us_VS_118_2_0_2_0_0%] htmlHelper,
	[%$TOPIC/dd470561_en-us_VS_118_2_0_2_0_1%] partialViewName,
	[%$TOPIC/dd470561_en-us_VS_118_2_0_2_0_2%] model,
	[%$TOPIC/dd470561_en-us_VS_118_2_0_2_0_3%] viewData
)
[[%$TOPIC/dd470561_en-us_VS_118_2_0_3_0_0%]]
public:
static void RenderPartial(
	[%$TOPIC/dd470561_en-us_VS_118_2_0_3_0_1%]^ htmlHelper, 
	[%$TOPIC/dd470561_en-us_VS_118_2_0_3_0_2%]^ partialViewName, 
	[%$TOPIC/dd470561_en-us_VS_118_2_0_3_0_3%]^ model, 
	[%$TOPIC/dd470561_en-us_VS_118_2_0_3_0_4%]^ viewData
)
static member RenderPartial : 
        htmlHelper:[%$TOPIC/dd470561_en-us_VS_118_2_0_4_0_0%] * 
        partialViewName:[%$TOPIC/dd470561_en-us_VS_118_2_0_4_0_1%] * 
        model:[%$TOPIC/dd470561_en-us_VS_118_2_0_4_0_2%] * 
        viewData:[%$TOPIC/dd470561_en-us_VS_118_2_0_4_0_3%] -> unit
public static function RenderPartial(
	htmlHelper : [%$TOPIC/dd470561_en-us_VS_118_2_0_5_0_0%], 
	partialViewName : [%$TOPIC/dd470561_en-us_VS_118_2_0_5_0_1%], 
	model : [%$TOPIC/dd470561_en-us_VS_118_2_0_5_0_2%], 
	viewData : [%$TOPIC/dd470561_en-us_VS_118_2_0_5_0_3%]
)

Parameters

htmlHelper
Type: System.Web.MvcHtmlHelper
The HTML helper.
partialViewName
Type: SystemString
The name of the partial view.
model
Type: SystemObject
The model for the partial view.
viewData
Type: System.Web.MvcViewDataDictionary
The view data for the partial view.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type HtmlHelper. When you use instance method syntax to call this method, omit the first parameter. For more information, see or .

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.