i m workingon the project based on datagrid , i wan to bold the selected cell,
i hav used the code
C1.Win.C1TrueDBGrid.Style s = new C1.Win.C1TrueDBGrid.Style();
Font newFont;
newFont = new Font(s.Font, FontStyle.Bold);
s.Font = newFont;
dgSheet.AddCellStyle(C1.Win.C1TrueDBGrid.CellStyleFlag.NormalCell, s);
dgSheet.UpdateData();
but is not working properly , actually it bold every cell after selection
plz help me in correcting the code....
anamika
Loading
anamika agrawalPosted Apr 24, 2008, 1:57 AM
i m beginner ...so kindly help me.......
Niradhip ChakrabortyPosted Apr 23, 2008, 6:10 PM
For DataGrid Row customization, a common approach is using the
"ItemDataBound" or "ItemCreated" event( GridView has "RowDataBound" and
"RowCreated" event). You can get the reference to database column
fields(pass through databinding) and change the certain property on Row (or
individual cells) in it. Here is a simple example that change the row's
Font-bold based on a column value:
protected void DataGrid1_ItemDataBound(object sender, DataGridItemEventArgs
e)
{
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType ==
ListItemType.AlternatingItem)
{
DataRowView drv = (DataRowView)e.Item.DataItem;
long id = (long)drv[0];
if (id > 3) e.Item.Font.Bold = true;
}
}
refer this code please.