'How can I show this enum description as a tooltip for each enum in my view.(DotnetCore).I have tried adding the DescriptionAttribute but getts error
The type or namespace name 'DescriptionAttribute' could not be found (are you missing a using directive or an assembly reference?)
public class Test
{
public Test()
{
}
public int Id { get; set; }
[Required]
public string Name { get; set; }
[Required]
[Display(Name = "Shape")]
public Shapes? Shape { get; set; }
}
public enum Shapes
{
[DescriptionAttribute("A shape with 3 strokes")]
Triangle,
[DescriptionAttribute("A rounded shape")]
Circle,
[DescriptionAttribute("A shape with 4 corners")]
Square,
Other
}
Solution 1:[1]
I think you are supposed to just use Display attribute and not Description attribute. Check this link (see the remarks section)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | PsiMatrix |
