Hi All,
I'm working with a Datagrid in which one of the columns is populated using a boolean value (bit in SQLSrv). Is there a way I can format this value to show a more user-friendly message . I would like to display 'Activate' for False and 'Deactivate' for True.
Thanks in advance,

Datagrids: How to format boolean values?
lipi
I find this solution. This work OK if field is read only. I hope this help you.
private void activatesTableDataGridView_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
{
if (activatesTableDataGridView.Columns[e.ColumnIndex].Name.Equals("ActiveColumn"))
{
try
{
bool b;
if (Boolean.TryParse(e.Value.ToString(), out b))
{
e.Value = (b "Active" : "Deactive");
}
}
catch (Exception) { }
}
}
Yours
Markku
dagfari
loopool
ChristianBG
NukeMan
Hi;
I have done something similar on one of my projects. I usually build my datatable and add a column with the IFF expression.
IFF(booleabVal>0,'Activate','Deactivate')
Shivam