A partial view enables you to define a view that will be rendered inside a parent view. Partial views are implemented like as user control in Asp.Net Web forms that is used for code re-usability. Partial views helps us to reduce code duplication.
Questions tagged [asp.net-mvc-partialview]
951 questions
8
votes
2 answers
Razor views vs partial views
how does visual studio determine which is a view vs a partial view? Another question would be; is there a way to convert my views into partial views?

frank
- 83
- 1
- 4
8
votes
2 answers
Html.Partial not rendering partial view
I have the following code in a view:
@if (SiteSession.SubPageHelper.DisplayType == DisplayType.List)
{
Html.Partial("_SubLandingPage_List");
}
else
{
Html.Partial("_SubLandingPage_Grid");
}
and within the partials I just have a foreach loop…
user1987162
8
votes
1 answer
Refresh only partial view in MVC4
I'm having a little bit of trouble with refreshing a partialview on mvc4, here is the code:

Victor Franchi Zeclhynscki
- 201
- 1
- 4
- 15
8
votes
1 answer
ASP.net MVC4: Using a different model in a partial view?
I am just learning ASP.net MVC so please bear with me if I am bad at explaining my issue.
Is it possible to use a different model in a partial view than what is being inherited in the view?
My view Index currently inherits LoginModel, which deals…

Neil
- 2,509
- 7
- 32
- 47
7
votes
1 answer
ASP.net MVC: Execute Razor from DB String?
I was thinking about giving end users the ability to drop Partial Views (controls) into the information being stored in the database. Is there a way to execute a string I get from the database as part of the Razor view?

Sam
- 9,933
- 12
- 68
- 104
7
votes
5 answers
How to render asp.net mvc view into angular 2?
I'm trying to integrate asp.net mvc with an angular 2 application. I understand that this is not ideal, but I am being asked to integrate some existing Mvc functionality (think big legacy app) into a brand new Angular 2 spa.
What I would like to be…

Tim Hardy
- 1,654
- 1
- 17
- 36
7
votes
2 answers
Render partial view to string MVC4
I am using the following to render a partial view to a string...
protected string RenderPartialViewToString(string viewName, object model)
{
if (string.IsNullOrEmpty(viewName))
viewName =…

MrBeanzy
- 2,286
- 3
- 28
- 38
6
votes
1 answer
How to return PartialView with model from custom AuthorizeAttribute
At the core of what I'm doing, what I would like is if you go to www.mysite.com/admin/index I want to render a partial view that shows "Unauthorized" that has a Model attached to it. I was really not wanting the site to show…

Kyle Crabtree
- 198
- 1
- 10
6
votes
1 answer
Hidden details option of dataTables when loaded through model MVC
I have a table of employees which I fetch using $.load ajax call by sending back a partialview as below:
Model Class
public class EmployeeDetails
{
public string FirstName{get;set;}
public string LastName{get;set;}
public string…

Guruprasad J Rao
- 29,410
- 14
- 101
- 200
6
votes
2 answers
ASP.NET MVC - Refresh PartialView when DropDownList changed
I have a search form that is an Ajax form. Within the form is a DropDownList that, when changed, should refresh a PartialView within the Ajax form (via a GET request). However, I'm not sure what to do in order to refresh the PartialView after I get…

Bryan Roth
- 10,479
- 15
- 47
- 56
6
votes
2 answers
How can I define partial views with dynamic JQuery scripts if bundled scripts are rendered at the bottom of the page?
I have a web application using MVC4 and Razor views that utilize a lot of JQuery and other plugin scripts.
For speeding up the rendering of views, I believe that in general, it is good practice to render the scripts at the bottom of the body, so the…

Dave Clemmer
- 3,741
- 12
- 49
- 72
6
votes
1 answer
Ajax Redirect to Page instead of Updating Target
I am using a partial view for login and would like to redirect the user to a new page on success and show the validation errors in the partial view if the model is invalid. The ajax target is being updated and success or failure. If the the model…

scottrakes
- 735
- 9
- 26
6
votes
1 answer
Send PartialView content as email
I have a PartialView that contains a HTML code with Razor annotations. It generates to me a page that I want to send by email to anyone. Is there a way to translate this PartialView into HTML content to send it?

Kiwanax
- 1,265
- 1
- 22
- 41
5
votes
2 answers
MVC 6 VNext how to set HtmlFieldPrefix?
My view is divided into partial views. Hence, at the time of submission my model isn't reconstructed correctly.
The page view displays employee data, where Employee.Contactinfo is the model of _contactInfo partial view, which again has a partial…

Mukesh Bhojwani
- 2,014
- 4
- 20
- 35
5
votes
1 answer
Different Model in Partial View
I have a partial view that is using a different model than the view that I'm rendering it in. I keep getting the error message.
The model item passed into the dictionary is of type 'JHelpWebTest2.Models.CombinedModels', but this dictionary…

hollyquinn
- 652
- 5
- 15
- 48