I want to set the border color of a cell element to red based on a condition in row formatting event, but even when I set BorderColor = Color.Red, it does not work. Even setting border thickness of cell element does not work.
How would I do this in cell formatting event?
I am using Q1 2008 SP1 version. the code that I am using and it does not set border is as below.
Thanks
Sunil
How would I do this in cell formatting event?
I am using Q1 2008 SP1 version. the code that I am using and it does not set border is as below.
Thanks
Sunil
if
(e.RowElement !=
null
&& e.RowElement.RowInfo
is
GridViewDataRowInfo)
{
GridCellElement cellElement = e.RowElement.RowInfo.Cells[
"AttributeName"
].CellElement;
if
(cellElement!=
null
&& (
int
)e.RowElement.RowInfo.Cells[
"AttributeId"
].Value == _duplicateRowIndex)
{
cellElement.ForeColor= Color.Red;
cellElement.ToolTipText =
"You input duplicate Attribute Name"
;
cellElement.BorderThickness =
new
Padding(1, 1, 1, 1);
cellElement.BorderColor = Color.Red;
cellElement.DrawBorder =
true
;
}
else
{
cellElement.ResetValue(VisualElement.ForeColorProperty);
cellElement.ToolTipText =
string
.Empty;
cellElement.ResetValue(LightVisualElement.BorderColorProperty);
}
}