어떤 경우에는 일부 일반 텍스트 값을 반환해야하는 Views/Shared
폴더에 공유보기를 추가하려고했습니다.ASP.NET MVC 4에서 공유보기 사용
@model string
@{
Layout = null;
Response.ContentType = "text/plain";
}
@Model
내가 컨트롤러에서이 방법을 사용하려 : 여기 내 공유보기 TextPlainView
이다 나는 모든 컨트롤러에 걸쳐이보기를 사용하려면
public ActionResult GetInfo(bool plain)
{
//Some code to prepare data
string result="Some data";
if (plain)
return View("TextPlainView", result);
else
return View(result);
}
를, 그래서 그것을 공유 할 싶어요.
The view 'TextPlainView' or its master was not found or no view engine supports the searched locations. The following locations were searched: ~/Views/Orders/TextPlainView.aspx ~/Views/Orders/TextPlainView.ascx ~/Views/Shared/TextPlainView.aspx ~/Views/Shared/TextPlainView.ascx ~/Views/Orders/0.master ~/Views/Shared/0.master ~/Views/Orders/TextPlainView.cshtml ~/Views/Orders/TextPlainView.vbhtml ~/Views/Shared/TextPlainView.cshtml ~/Views/Shared/TextPlainView.vbhtml ~/Views/Orders/0.cshtml ~/Views/Orders/0.vbhtml ~/Views/Shared/0.cshtml ~/Views/Shared/0.vbhtml
시도해보십시오. http://www.codeproject.com/Tips/617361/Partial-View-in-ASP-NET-MVC-4 – Ehsan