[DisplayName("Planned Amt($):")]
public string PlannedAmount { get; set; }
[DisplayName("Unallocated Amt($):")]
public string UnallocatedAmount { get; set; }
I have this members in my class .Based on budgetType variable value i need to change the DisplayName Value for both the attributes. Please, let me know how to do that.
You should just be able to inherit from DisplayNameAttribute and override the DisplayName property:
public class DisplayNameExAttribute : DisplayNameAttribute
{
public override string DisplayName
{
get
{
// do what you want here.
return base.DisplayName;
}
}
}
I haven't actually tried to implement this, so it is possible that the DisplayName attribute is coded such that some other extension point will have to be used, but I'll try to confirm.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With