I'm involved in ASP.NET MVC project which requires me to complete on it. Since I'm totally new to MVC approach I found something which I couldn't understand I tried to search for it but nothing been found I even don't know how to ask the question properly so excuse me.
I want to bind a model's Property to a resource string so when using @HTML.LabelFor(model => model.Property)
it got rendered with the right resource string. I know that it can be binded using data anotations by adding this line in the model:
[Display(Name = "ResourceStringName", ResourceType = typeof(MyResource))]
string CompanyName {get; set;};
This approach isn't good because when I want to update my model from database it will be overwritten. But in the project that I'm working on the properties got binded to the right resource string without adding data annotations in the model but I can't figure out how to do this for a newly added property from database. Do anyone know how to bind a resource string to model property without adding data annotations ?
EDIT
This is a piece of View:
<div class="form-group clearfix">
<label class="col-sm-4 col-sm-offset-1 control-label">
@Html.LabelFor(model => model.RejectedEmailTemplate)
<span class="template">@Infas.OnlineApplications.Resources.MyResource.RejectedEmailTemplate</span>
</label>
<div class="col-sm-6">
@Html.TextAreaFor(model => model.RejectedEmailTemplate, new { disabled = "disabled", @class = "emailTemplate form-control", rows = 12 })
@Html.ValidationMessageFor(model => model.RejectedEmailTemplate)
</div>
</div>
<div class="form-group clearfix">
<label class="col-sm-4 col-sm-offset-1 control-label">
@Html.LabelFor(model => model.ReturnApplicationEmailTemplate)
<span class="template">@Infas.OnlineApplications.Resources.MyResource.ReturnApplicationEmailTemplate</span>
</label>
<div class="col-sm-6">
@Html.TextAreaFor(model => model.ReturnApplicationEmailTemplate, new { disabled = "disabled", @class = "emailTemplate form-control", rows = 12 })
@Html.ValidationMessageFor(model => model.ReturnApplicationEmailTemplate)
</div>
</div>