As shown below I have created a List of equip.I would like to have the column names more descriptive - is there an attribute that I can use in the equip.properties?
DataGridView.Datasource = EquipList;
List<equip> EquipList = new List<equip>();
public class equip
{
public int EquipID {get;set;}
public string EquipName {get;set;}
}
Okay, maybe I didn't explain myself properly...I am hoping that that there is an attribute that could be applied like....
[Alis("name I would like to see in the gridview")]
public int EquipID {get;set;}
if not I'll just stick with the old tired ways
Later on that same morning....
I got it!
using System.ComponentModel;
[DisplayName("the nice name")]
public int EquipID {get;set;}
This works..
using System.ComponentModel;
List<equip> EquipList = new List<equip>();
DataGridView.Datasource = EquipList;
below:the first two properties in the class will be displayed with with their new names, the third property will not display as per the Browsable attribute.
public class equip
{
[DisplayName("Equipment ID")]
public int EquipID {get;set;}
[DisplayName("Equipment Name")]
public string EquipName {get;set;}
[Browsable(false)]
public int recordId {get; private set;}
}
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