I found the follwing code in MSDN . How can I change this "UnitsInStock" with a value that my Product class has. For instance, Product has a FieldType property which has a string property called Name. I'd like to use that FieldType.Name property instead of hardcoding with a string. However, I cannot specify "this", or the current instance as an argument of the UIHint attribute . Please, help
using System;
using System.Web.DynamicData;
using System.ComponentModel.DataAnnotations;
[MetadataType(typeof(ProductMetadata))]
public partial class Product
{
}
public partial class ProductMetadata
{
[UIHint("UnitsInStock")]
[Range(100, 10000,
ErrorMessage = "Units in stock should be between {1} and {2}.")]
public object UnitsInStock;
}