So we are populating rad grid from data which we get from database.
my requirement is like based on datatype which we get from service(database) I need to show checkbox or datetime or text in same column.
if I will be receiving 1 or 0 I need to show checkbox marked as checked / unchecked respectively if got text than simple text need to be shown.
pls check below image for more reference.
Requirement
What we tried:
so I am here sharing you my the things we tried.
Actually we tried using cell formatting event to change the cell element based on data it is working fine but we are experiencing visual glitch's.
glitch is like have checkbox on all columns of same row as we scroll right or left in grid.
Note: on the first time its work fine but when we scroll than glitches come.
I am attaching the code snippet which we tried also attaching video clip which will show the glitches.
Code snippet:
private void GrdHistory2_CellFormatting(object sender, CellFormattingEventArgs e)
{
if (e.CellElement is GridDataCellElement)
{
// Assuming you have a data source where the column "MixedTypeData" determines the cell type
if (e.Column.Name == grdHistoryColNewValue.Name)
{
if (e.Row.Cells["New Value"].Value != null)
{
if (e.Row.Cells["New Value"].Value.ToString() == "0")
{
e.CellElement.Children.Clear();
RadCheckBoxElement checkBoxElement = new RadCheckBoxElement();
e.CellElement.Children.Add(checkBoxElement);
}
else if(e.Row.Cells["New Value"].Value.ToString() == "1")
{
e.CellElement.Children.Clear();
RadCheckBoxElement checkBoxElement = new RadCheckBoxElement();
e.CellElement.Children.Add(checkBoxElement);
}
}
}
}
}
pls check below gif image.
Here I just need to show in column "New Value" but it also coming on all other column while scrolling. disappear after while .
Please suggest me some solution so that it would work for my use case.
Shubham Jain