Merge pull request #249 from pcc/xgetinputfocus
[mono.git] / mcs / class / System.Web.Mvc3 / Mvc / PartialViewResult.cs
1 namespace System.Web.Mvc {
2     using System;
3     using System.Globalization;
4     using System.Text;
5     using System.Web.Mvc.Resources;
6
7     public class PartialViewResult : ViewResultBase {
8
9         protected override ViewEngineResult FindView(ControllerContext context) {
10             ViewEngineResult result = ViewEngineCollection.FindPartialView(context, ViewName);
11             if (result.View != null) {
12                 return result;
13             }
14
15             // we need to generate an exception containing all the locations we searched
16             StringBuilder locationsText = new StringBuilder();
17             foreach (string location in result.SearchedLocations) {
18                 locationsText.AppendLine();
19                 locationsText.Append(location);
20             }
21             throw new InvalidOperationException(String.Format(CultureInfo.CurrentCulture,
22                 MvcResources.Common_PartialViewNotFound, ViewName, locationsText));
23         }
24     }
25 }