Questions tagged [asp.net-mvc-partialview]

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.

951 questions
5
votes
2 answers

How to load partial view on clicking Html.ActionLink?

Can someone please tell me on how to load PartialView in the same page when clicking on Html.ActionLink. I have listed down my requirements below. I have an Index page which will list the employees from Employee table, also each row in a table will…
5
votes
3 answers

System.NullReference Exception occurred in App_Web_XXX.dll - Error in Partial View

I'm getting this error, with a random string in the dll name, when landing on one of my MVC pages. A first chance exception of type System.NullReferenceException occurred in App_Web_cjmhrrqn.dll. Additional information: Object reference not…
5
votes
3 answers

ASP.NET MVC 4 Default _LoginPartial template Logout not working

I have been fiddling around with the _Layout and _PartialLayouts of the default MVC 4 templates and suddenly the 'Logout' feature in the '_PartialLogin' doc has stopeed working. To give you more info, the _LoginPartial.cshtml is called from the…
5
votes
1 answer

PartialView must derive from WebViewPage error

I am getting "must derive from WebViewPage" error when calling PartialView inside other folder instead Views folder. Error System.InvalidOperationException: The view at '~/Modules/HtmlContent/_HtmlContent.cshtml' must derive from WebViewPage, or…
user2282567
  • 781
  • 1
  • 7
  • 14
5
votes
2 answers

ASP.net MVC 4 loading menu from database to Partial View

i'm an mvc newbie. What i'm trying to do is to load menu from database and display it in partial view. This partial view will be called from _layout view. Home Controller in Home controller i add an action called "_MainMenu" public class…
Haqi Petrucci
  • 53
  • 1
  • 1
  • 4
5
votes
2 answers

In MVC do partial views inherit the models of their Parent views?

I'm passing some data to a View from my controller, which I wish to display inside a partial view inside that View (don't ask, it's complicated). I know I probably shouldn't even be passing a model to a view that's inded for another view, but I've…
Mohammad Sepahvand
  • 17,364
  • 22
  • 81
  • 122
5
votes
1 answer

Knockout Js, JQuery UI Dialog and Partial view

I have a requirement whereby I need to load in Partial View(razor) in Jquery Modal dialog, the problem is I am not able to integrate with Knockout. The implementation will be like this, as a user enters a site, I need to show him a Modal dialog…
5
votes
6 answers

Rendering Partial Views in a Loop in MVC3

I have a pretty simple scenario, Model for my view is a List. Loop through List like @foreach(CustomObject obj in Model) { Html.Partial("_TrackingCustomObject",obj) } So i was expecting to have number of partial views according to my list. Partial…
manav inder
  • 3,531
  • 16
  • 45
  • 62
5
votes
3 answers

PartialView() does not return a View with a underscore

TemplateController: this works: return PartialView("_Create"); but this does not work: return PartialView(); The asp.net mvc convention should actually check a View folder with the name of the controller => "Template" and check for a View the…
Pascal
  • 12,265
  • 25
  • 103
  • 195
4
votes
2 answers

Why is my validation firing on the get request before the post in MVC3?

I have a MVC3 view that enables the user to create a couple different things. Within the parent view the forms to do so are broken up via jquery ui tabs like the following:
4
votes
6 answers

Why does MVC look for .aspx and .ascx for both full and partial views?

I've just been bitten by a problem where I have a view (FindUser.aspx) trying to render a partial view (FindUser.ascx). The default search paths for views look for a file named after the view in a variety of folders. Rather surprisingly, for views,…
citizenmatt
  • 18,085
  • 5
  • 55
  • 60
4
votes
2 answers

Replace partialview after action in ASP.Net MVC

I'm still quite new to ASP.NET MVC and wonder how-to achieve the following: On a normal view as part of my master page, I create a varying number of partial views with a loop, each representing an item the user should be able to vote for. After…
Chris
  • 721
  • 1
  • 10
  • 23
4
votes
1 answer

MVC3: How to specify that a partial view be loaded when it is located in a different, non-searched, folder?

I am trying to include a partial view in a view that is located in a different folder. So I have the following view: /_mvc/Views/Home/Index.cshtml It has the following line of code: @Html.Partial("~/_mvc/Views/Subject/_QuickSearch.cshtml",…
Leslie Hanks
  • 2,347
  • 3
  • 31
  • 42
4
votes
2 answers

ASP.Net MVC: Html.Display() for object in a Collection

The standard MVC example to draw an item with the appropriate View Template is: Html.DisplayFor(m => m.Date) If the Model object has a property named Date of type DateTime, this returns a string with the HTML from the Display/DateTime.ascx…
Chris Moschini
  • 36,764
  • 19
  • 160
  • 190
4
votes
2 answers

Redirect Partial View to login page when session expires

Is there a simple way to redirect the entire page (not just the partial view) to the login page after the session has expired? I have tried the following solutions, but can't get it to work: .Net MVC Partial View load login page when session…
Erik Sellberg
  • 511
  • 1
  • 9
  • 23