How to pass Model to Partial View in ASP.NET MVC?

I have created Bootstrap tabs inside ASP.NET MVC razor view and calling Partial View from inside bootstrap, but I would like to know how can I pass Model to partial view while rendering it?


I would also like to pass ViewData, if possible.Thanks

Asked by:- neena
: 147 At:- 6/5/2020 3:44:34 PM
ASP.NET MVC C# Model to Partial View

1 Answers
profileImage Answered by:- vikas_jk

You can simply pass model like


Inside your Partial view, you can get Model values like you usually do in any View

Suppose _PartialView.cshtml looks like this

@model ProjectName.Model


If you want to pass model with View data to partial view, just add viewdata after Model

@Html.Partial("~/Views/Home/_PartialView.cshtml",Model, new ViewDataDictionary { { "ViewDataName", "ViewDataValue"} })
At:- 6/5/2020 3:58:01 PM

Login/Register to answer
Register directly by posting answer/details

Full Name *

Email *

By posting your answer you agree on privacy policy & terms of use

Subscribe Now

Subscribe to our weekly Newsletter & Keep getting latest article/questions in your inbox weekly