asp.net - MVC 3 Validation Attribute Error Message for Multi Tenant Application -
i working on multi tenant application using mvc3 , c#. using model class properties decorated validation attributes. want return tenant specific error messages on client side , on server side well.
is there way hook mvc validation , render / return tenant specific messages per each request in runtime?
my code snippet sipmle:
model:
public class testmodel { [required(errormessageresourcename="errormessage", errormessageresourcetype=typeof(global)] [regularexpression(@"\d+", errormessageresourcename="errormessagedigit", errormessageresourcetype=typeof(global)] public string testproperty {get; set;} }
view:
@using(html.beginfrom()) { @html.validationsummary(false, "")<br/> @html.textboxfor(x => x.textproperty)<br /> <input type="submit" value="submit" /> }
one approach create set of custom validation attributes each inherit 1 of existing validation attributes (e.g. myrequired
), include code inject tenant specific error message.
Comments
Post a Comment