I've created a simple RadGridView with 2 columns and turned off displaying grid lines and I get the following error:
Object reference not set to an instance of an object.
at Telerik.WinControls.UI.GridRowElement.UpdateSelectedState()
Seems that setting display.HideSelection=true causes BestFit to raise the error.
Here's the code that reproduces the problem:
Object reference not set to an instance of an object.
at Telerik.WinControls.UI.GridRowElement.UpdateSelectedState()
Seems that setting display.HideSelection=true causes BestFit to raise the error.
Here's the code that reproduces the problem:
private
void
GenerateConfigurationSummary(RadGridView display)
{
const
string
colValue =
"value"
;
const
string
colHeader =
"header"
;
display.HideSelection =
true
;
display.Rows.Clear();
display.Columns.Clear();
display.Columns.Add(colHeader);
display.Columns.Add(colValue);
display.ReadOnly =
true
;
display.ShowColumnHeaders =
false
;
display.ShowRowHeaderColumn =
false
;
display.TableElement.DrawBorder =
false
;
display.CellFormatting += (s, e) =>
{
if
(e.Column.Name == colHeader)
e.CellElement.Font =
new
System.Drawing.Font(e.CellElement.Font, System.Drawing.FontStyle.Bold);
e.CellElement.DrawBorder =
false
;
};
try
{
display.Rows.Add(
"Test Row 1"
,
"Test Value 1"
);
display.Rows.Add(
"Test Row 2"
,
"Test Value larger line goes here"
);
display.Rows.Add(
"Test Row 3"
,
"Test Value 1"
);
foreach
(var col
in
display.Columns)
col.BestFit();
}
catch
(Exception ex)
{
System.Diagnostics.Debug.WriteLine(
"Error Formatting Display: "
+ ex.ToString());
}
}