2017-05-19 67 views

回答

1

否Html.partial()不區分大小寫。我測試了它。

例如:

讓我們說你的局部視圖名稱是「_HeaDing.cshtml」,其在同一文件夾的地方。

然後調用在不同情況下的局部視圖象下面這樣:

1. @Html.Partial("_heading")-All characters are in smaller case 
2. @Html.Partial("_HEADING")- All characters are in Upper case 

在所有組合的情況下,它會通過調用同一文件正常工作。

附加信息:

喚起在不同的文件夾或在不同的路徑的看法,請按照下面的語法:

// Uses a view in current folder with this name 
// If none is found, searches the Shared folder 
@Html.Partial("ViewName") 

// A view with this name must be in the same folder 
@Html.Partial("ViewName.cshtml") 

// Locate the view based on the application root 
// Paths that start with "/" or "~/" refer to the application root 
@Html.Partial("~/Views/Folder/ViewName.cshtml") 
@Html.Partial("/Views/Folder/ViewName.cshtml") 

// Locate the view using relative paths 
@Html.Partial("../Account/LoginPartial.cshtml") 

來源:https://docs.microsoft.com/en-us/aspnet/core/mvc/views/partial

希望這將對你有幫助,請讓我知道你的想法或反饋

感謝

KARTHIK