문제

I have this code:

    public class MyModelBinder : IModelBinder
    {
        public object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext)
        {

         string modelName = bindingContext.ModelName;

modelName returns the property name, but I need to access the DisplayName, rather than the property name, for example "First Name" rather than "FirstName". Is this possible from the controllerContext or bindingContext? I couldn't find anything in the watch.

올바른 솔루션이 없습니다

다른 팁

string modelName = bindingContext.ModelMetadata.DisplayName;
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top