I try to embed RadCheckBoxElement to GridView in CellFormating event. My scenario is to show a RadCheckBoxElement in row "caption0". My Telerik controls version is Q1 2010.
void radGridView1_CellFormatting(object sender, CellFormattingEventArgs e) |
{ |
if (e.CellElement.ColumnInfo is GridViewDataColumn && ((GridViewDataColumn)e.CellElement.ColumnInfo).FieldName == "Caption") |
{ |
if (!(e.CellElement.RowElement is GridTableHeaderRowElement)) |
{ |
if (e.CellElement.Text.Equals("caption0")) |
{ |
if (e.CellElement.RowInfo.Cells["Value"].CellElement.Children.Count > 0) |
return; |
RadCheckBoxElement element = new RadCheckBoxElement(); |
e.CellElement.RowInfo.Cells["Value"].CellElement.Children.Add(element); |
} |
} |
} |
} |
It seems that everything works fine without scrollbar.
However, if I scroll the scrollbar, a strange issue will happen. The RadCheckBoxElement will be embedded not only in row "caption0" but also in other rows. If I scroll the scrollbar several times, more and more RadCheckBoxElement will be shown in different rows.
Please refer to the attached images.
Could anybody help me? Thank you.