Frage

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.

Keine korrekte Lösung

Andere Tipps

string modelName = bindingContext.ModelMetadata.DisplayName;
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top