在Data Entity框架中显示名称 [英] Display name in Data Entity framework
本文介绍了在Data Entity框架中显示名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想知道如何在Data Entity框架中更改显示名称和错误消息。我尝试这样,但没有工作。
I'm wondring how to change display name, and error message in Data Entity framework. i tried like this but it didn't worked.
[Required(ErrorMessage = "Required .... :")]
[Display(Name = "Name Agency : ")]
[EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
[DataMemberAttribute()]
public global::System.String Nag
{
get
{
//code
}
set
{
//code
}
}
这只是我的观点(我的表单的一部分,因为它是所有这一切都是这样),它允许我添加新的数据到我的Db:
this is my view only the form( part of my form because it's all similaire this) it allow me to add new data into my Db :
<% using (Html.BeginForm("addcar", "Agence", FormMethod.Post, new { @class = "search_form" }))
{ %>
<%: Html.ValidationSummary(true) %>
<div class="editor-label">
<%: Html.LabelFor(model => model.Dmcv) %>
</div>
<div class="editor-field">
<%: Html.EditorFor(model => model.Dmcv) %>
<%: Html.ValidationMessageFor(model => model.Dmcv) %>
</div>
<div class="editor-label">
<%: Html.LabelFor(model => model.Puisv) %>
</div>
<div class="editor-field">
<%: Html.EditorFor(model => model.Puisv) %>
<%: Html.ValidationMessageFor(model => model.Puisv) %>
</div>
// Similaire code
<p>
<input type="submit" value="Create" />
</p>
<% } %>
推荐答案
更改 [显示=名称代理)]
至 [DisplayName(Name Agency)]
。
这篇关于在Data Entity框架中显示名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文