Display field names from DataAnnotation in column headers
Hello, can I somehow display field names from DataAnnotation in column headers?
For example - field:
[Display(Name = "Route ID")]column binding:
public long route_id {get; set;}
new Column { Bind = "route_id", Header = " " }Thank You for really awesome library.
Vladimir Kerzhentsev
asked
at 17 Jun 2019
Answers
-
you set the column header like this:
new Column { Header = "abc" ...
, so if you can get the value you want in the view, you'll be able to use in the header, so what you need to find out is how to get the Name property of display attribute in C#. maybe this will help: https://stackoverflow.com/questions/5015830/get-the-value-of-displayname-attribute perhaps you can create aColumn
extension method that will set bothBind
andHeader
Omuanswered at 17 Jun 2019-
Thank You! That should work.at 20 Jun 2019 Vladimir Kerzhentsev
-