疑問があり実用的な理由から、私はEditorTemplatesやDisplayTemplatesと同じように、LabelTemplateのデフォルトを作成したいと思います。Html.LabelとHtml.LabelFor()のLabelTemplatesをASP.NET MVCで作成することはできますか?
ので、代わりにこの:
@Html.LabelFor(x => x.PropertyName, "Property Name")
またはその代わりに、この(ビューモデルでそれを行うには良い方法):
@Html.LabelFor(x => x.PropertyName)
:
[DisplayName("Property Name")]
public string PropertyName{ get; set; }
私はこれをしたいです
これで(このようなフォルダ内:/ Views/Shared/LabelTemplates)
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<System.String>" %>
//Display logic here
コーダーを助けることができますか?
これは、どのように 'DisplayTemplates'と違うのですか? –