I have a DataTable
which contains columns of various data types - int
, string
, bool
, Enum
( like Severity
in below example):
hostTable = new DataTable();
hostTable.Columns.Add("Suspended", typeof(bool));
hostTable.Columns.Add("Succ Tests", typeof(int));
hostTable.Columns.Add("Unsucc Tests", typeof(int));
hostTable.Columns.Add("System Name", typeof(string));
hostTable.Columns.Add("System IP", typeof(string));
hostTable.Columns.Add("Criticality", typeof(Severity));
hostTable.Columns.Add("Alert Email To", typeof(string));
hostTable.Columns.Add("Alert Email Cc", typeof(string));
hostTable.Columns.Add("Likely Impact", typeof(string));
hostTable.Columns.Add("Likely Causes", typeof(string));
hostTable.Columns.Add("Escalation", typeof(string));
hostTable.Rows.Add((bool)hd.IsSuspended, (int)hd.SuccTests, (int)hd.UnSuccTests,
hd.SystemName, hd.SystemIp, (Severity)hd.Criticality, hd.AlertEmailToAddress,
hd.AlertEmailCcAddress, hd.LikelyImpact, hd.LikelyCauses, hd.EscalationInstructions);
dgvHostTable.DataSource = hostTable;
When I bind this to a DataGridView
, how can I make the columns show with this settings:
- bool columns → ComboBox with true/false options
- Enum columns → ComboBox with the list of enums
- String columns → Just as editable text field