1 /* ****************************************************************************
\r
3 * Copyright (c) Microsoft Corporation. All rights reserved.
\r
5 * This software is subject to the Microsoft Public License (Ms-PL).
\r
6 * A copy of the license can be found in the license.htm file included
\r
7 * in this distribution.
\r
9 * You must not remove this notice, or any other, from this software.
\r
11 * ***************************************************************************/
\r
13 namespace System.Web.Mvc {
\r
15 using System.Globalization;
\r
17 using System.Web.Mvc.Resources;
\r
19 public class PartialViewResult : ViewResultBase {
\r
21 protected override ViewEngineResult FindView(ControllerContext context) {
\r
22 ViewEngineResult result = ViewEngineCollection.FindPartialView(context, ViewName);
\r
23 if (result.View != null) {
\r
27 // we need to generate an exception containing all the locations we searched
\r
28 StringBuilder locationsText = new StringBuilder();
\r
29 foreach (string location in result.SearchedLocations) {
\r
30 locationsText.AppendLine();
\r
31 locationsText.Append(location);
\r
33 throw new InvalidOperationException(String.Format(CultureInfo.CurrentUICulture,
\r
34 MvcResources.Common_PartialViewNotFound, ViewName, locationsText));
\r