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,
Kirtan PatelPosted Aug 26, 2009, 8:34 AM
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);
}
}
Ramalingam SPosted Aug 26, 2009, 7:00 AM
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);
}
}
}
}
tekkPosted Aug 26, 2009, 1:44 AM
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 PatelPosted Aug 25, 2009, 8:09 AM
is there any field in database to know it ????
if so let me tel :) i will help you :)