Hi,
I work with radGridView and color some cells according to the option set by user. So I created a function to color/uncolor cell of the grid. Bellow the fonction to reset the color of the (second columns of the) grid :
This function work well in most of cases, but when I delete (all) the rows of my grid and add new ones and then call this function again, that doesn't work : the GridCellElement returns null. If I give the control to the user and then call again the function, it will work.
In my case, it works for the 4 first line of my radGridView (that contains 15 rows). All the rows are threated the same way and the Value of all cells are defined and accessible.
It seems that the source of the problem is in the radGridView.TableElement.VisualRows where some items are missing. They are only four element (instead of 15) in VisualRows object.
Do you have an idea to how solve the problem ?
Best regards,
Georges DE VOS.
I work with radGridView and color some cells according to the option set by user. So I created a function to color/uncolor cell of the grid. Bellow the fonction to reset the color of the (second columns of the) grid :
private
bool
ResetCellsColor(RadGridView radGridView)
{
Boolean ret =
true
;
try
{
GridViewColumn gvc =
null
;
if
(radGridView.Columns.Count > 2)
{
gvc = radGridView.Columns[2]
as
GridViewColumn;
}
if
(gvc ==
null
)
{
ret =
false
;
}
else
{
for
(
int
i = 0; i < radGridView.Rows.Count; i++)
{
if
(radGridView.Rows[i].IsVisible)
{
GridViewRowInfo gvri = radGridView.GridElement.GridViewInfo.Rows[i]
as
GridViewRowInfo;
if
(gvri ==
null
)
{
ret =
false
;
continue
;
}
GridCellElement gce = radGridView.TableElement.GetCellElement(gvri, gvc)
as
GridCellElement;
if
(gce !=
null
)
{
gce.ResetValue(VisualElement.ForeColorProperty);
gce.ResetValue(VisualElement.FontProperty);
gce.DrawFill =
false
;
}
else
{
ret =
false
;
}
}
}
}
}
catch
{ ret =
false
; }
return
ret;
}
This function work well in most of cases, but when I delete (all) the rows of my grid and add new ones and then call this function again, that doesn't work : the GridCellElement returns null. If I give the control to the user and then call again the function, it will work.
In my case, it works for the 4 first line of my radGridView (that contains 15 rows). All the rows are threated the same way and the Value of all cells are defined and accessible.
It seems that the source of the problem is in the radGridView.TableElement.VisualRows where some items are missing. They are only four element (instead of 15) in VisualRows object.
Do you have an idea to how solve the problem ?
Best regards,
Georges DE VOS.