I just came across this problem today in an app using Telerik RadGridView 2017.2.613.40. I had columns defined in code:
_grid.Columns.AddRange(
//...more columns
new GridViewCheckBoxColumn
{
Name = "IsSmallLabel",
FieldName = "IsSmallLabel",
MinWidth = 100,
MaxWidth = 100,
IsVisible = true,
ReadOnly = false,
HeaderText = "Small label"
},
new GridViewCheckBoxColumn
{
Name = "IsTechCard",
FieldName = "IsTechCard",
MinWidth = 100,
MaxWidth = 100,
IsVisible = true,
ReadOnly = false,
HeaderText = "Tech card"
});
And an OnCellFormatting event:
private void OnCellFormatting(object sender, CellFormattingEventArgs e)
{
try
{
var checkCell = e.CellElement as GridCheckBoxCellElement;
if (checkCell == null) return;
var poItem = e.Row.DataBoundItem as PurchaseOrderItem;
if (poItem == null) return;
if (string.Equals(e.Column.Name, "IsSmallLabel", StringComparison.OrdinalIgnoreCase))
{
checkCell.Visibility = !string.IsNullOrEmpty(poItem.LotNo) ? ElementVisibility.Visible : ElementVisibility.Collapsed;
checkCell.Value = !string.IsNullOrEmpty(poItem.LotNo);
}
else if (string.Equals(e.Column.Name, "IsTechCard", StringComparison.OrdinalIgnoreCase))
{
checkCell.Visibility = poItem.TechnologyCard != null ? ElementVisibility.Visible : ElementVisibility.Collapsed;
checkCell.Value = poItem.TechnologyCard != null;
}
}
catch (Exception ex)
{
_logger.Error(ex);
}
}
The two fields were actually missing from the model and adding them solved the problem with the app hanging. The issue seemed to be related to the formatting function as removing it would also stop the app from hanging.
CellFormatting? What format does your grid lose exactly? - roemel