E
ErezBeck
Guest
Hello
I fill data grid view in code by bounding data:
var table = new DataTable();
table.Columns.Add("Id");
table.Columns.Add("ExecTime", typeof(DateTime));
table.Columns.Add("Instrument");
...
... adding some columns ...
var row = table.NewRow();
row["Id"] = id;
row["ExecTime"] = creationDate;
row["Instrument"] = instrument;
table.Rows.Add(row);
dgv.DataSource = table;
I like to do a custom comparison for columns like ID (upon clicking on the header) since ID can be once only numbers and once only strings (result is striong from database so I cannot know in advance, I just leave the header as a string type)
Since I am bounding data, I cannot use dvg_SortCompare Since this event is not firing.
I tried to set column sort mode to programmatic but it did not help to fire this event.
How can I add a custom compactor to my grid columns when using data bounding, so I can control the sorting while clicking on the headers ?
I want to keep setting my DataSource that way
Will appreciate a code sample if it can be done
Thank you
Erez
Continue reading...
I fill data grid view in code by bounding data:
var table = new DataTable();
table.Columns.Add("Id");
table.Columns.Add("ExecTime", typeof(DateTime));
table.Columns.Add("Instrument");
...
... adding some columns ...
var row = table.NewRow();
row["Id"] = id;
row["ExecTime"] = creationDate;
row["Instrument"] = instrument;
table.Rows.Add(row);
dgv.DataSource = table;
I like to do a custom comparison for columns like ID (upon clicking on the header) since ID can be once only numbers and once only strings (result is striong from database so I cannot know in advance, I just leave the header as a string type)
Since I am bounding data, I cannot use dvg_SortCompare Since this event is not firing.
I tried to set column sort mode to programmatic but it did not help to fire this event.
How can I add a custom compactor to my grid columns when using data bounding, so I can control the sorting while clicking on the headers ?
I want to keep setting my DataSource that way
Will appreciate a code sample if it can be done
Thank you
Erez
Continue reading...