I have a datagrid with itemsource as list. with certain content.
now depending on new content in the list i need to display as bold in datagrid.
like i need to display the mails in Inbox in a datagrid... which has both read and unread mails ..if the mail is unread i need to display that row content
as Bold ..Is this possible?????
as anyone explain this to me
Thanx in advance,

Ramalingam S25 reputationPosted Aug 26, 2009, 3:00 AM EDT
After assigning the datasource to the datagridview
private void dataGridView1_DataBindingComplete(object sender, DataGridViewBindingCompleteEventArgs e)
{
for (int rowIndex = 0; rowIndex < dataGridView1.Rows.Count; rowIndex++)
{
if (dataGridView1.Rows[rowIndex].Cells["Status"].Value != null)
{
if ((bool)dataGridView1.Rows[rowIndex].Cells["Status"].Value)
{
//read mail
}
else
{
//Unread Mail
dataGridView1.Rows[rowIndex].DefaultCellStyle.Font = new Font(Font.FontFamily, Font.Size, FontStyle.Bold);
}
}
}
}
Kirtan PatelRank #292 · 8.6K reputationPosted Aug 25, 2009, 4:09 AM EDT
is there any field in database to know it ????
if so let me tel :) i will help you :)
tekk62 reputationPosted Aug 25, 2009, 9:44 PM EDT
hi,
In my each record contain "status" field, its contain "0" or "1" value, 0-mean unread msg and 1-mean read msg
Thanks..
Kirtan PatelRank #292 · 8.6K reputationPosted Aug 26, 2009, 4:34 AM EDT
After Filling Data in DataGridView Execute Following Code here in Cell[1] 1 is your column index :)
dont forget to mark "Do you like answer" please :)
foreach (DataGridViewRow r in dataGridView1.Rows)
{
if ( (Convert.ToInt32(r.Cells[1].Value) == 0))
{
//Set Row Font to Bold
r.DefaultCellStyle.Font = new Font("Arial", 12, FontStyle.Bold);
}
}