Hello,
I think I have found a bug in the radgridview behavior:
My radgridview is structured by :
- A Tree with a self reference hierarchy.
- Child templates for some elements in the tree
My code looks like this :
radGridView.Relations.AddSelfReference(radGridView.MasterTemplate,
"CategoryId"
,
"ParentCategoryId"
);
GridViewTemplate childTemplate = CreateChildTemplate();
GridViewRelation relation =
new
GridViewRelation(
this
.radGridView.MasterTemplate, childTemplate);
relation.ChildColumnNames.Add(
"T_RIGHT"
);
radGridView.Relations.Add(relation);
For the CreateChildTemplate(), it looks like this :
GridViewTemplate childTemplate =
new
GridViewTemplate();
childTemplate.AutoGenerateColumns =
false
;
radGridView.Templates.Add(childTemplate);
GridViewDecimalColumn decColumn =
new
GridViewDecimalColumn
{
Name =
"RightId"
,
HeaderText =
"Right Id"
,
FieldName =
"RGT_ID"
,
IsVisible =
false
,
MinWidth = 100
};
childTemplate.Columns.Add(decColumn);
GridViewTextBoxColumn tbxColumn =
new
GridViewTextBoxColumn
{
Name =
"RightName"
,
HeaderText =
"Right Name"
,
FieldName =
"RGT_NAME"
,
ReadOnly =
true
,
MinWidth = 100
};
childTemplate.Columns.Add(tbxColumn);
GridViewCheckBoxColumn chkxColumn =
new
GridViewCheckBoxColumn
{
Name =
"Checkbox"
,
EnableHeaderCheckBox = true,
FieldName =
"HasAccess"
,
};
childTemplate.Columns.Add(chkxColumn);
This tree works fine, as expected.
But when I try to implement the EnableHeaderCheckBox feature, I have an error
'System.NullReferenceException' dans Telerik.WinControls.GridView.dll
But the header checkbox works fine if I comment the line which enables the self referencing :
//radGridView.Relations.AddSelfReference(radGridView.MasterTemplate, "CategoryId", "ParentCategoryId");
Can you reproduce the problem ? What can I do with this behavior ?
Thanks in advance for your help.