I have this table in database:
applicant | module | date | approvation |
xxxx xxxx xxxx xxxxxxx
yyyy yyyy yyyy yyyyyyy
tttt tttt tttt ttttttt
I have this db table. After query I assign
DataTable
to my DataGridView.DataSource
:
QueryAssist qa = new QueryAssist();
DataTable dt = new DataTable();
dt = qa.runQuery('myquery');
dgvApprovazione.DataSource = dt;
dgvApprovazione.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.DisplayedCells);
// modify, transform 2nd column in cellLink
foreach (DataGridViewRow row in dgvApprovazione.Rows)
{
row.Cells[1] = new DataGridViewLinkCell();
}
Now I want to transform column approvation
that is a string approved
or not approved
and show a check box instead.
if value of this cell is approved
check box is checked and not modified (onlyread).
something similar:
foreach (DataGridViewRow row in dgvApprovazione.Rows)
{
if (row.Cells[3].Value.ToString().Equals("APPROVED"))
{
row.Cells[3] = new DataGridViewCheckBoxCell();
}
}
I have a problem to implement ... help me.
It's possible ? How?
recapping:
I want to change a column that value contain is a text/string (approved or not approved ) in checkbox (checked or unchecked)
Sorry for bad english ..
Good alternatives?