2017-05-19 96 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

相关问题