This is a migrated thread and some comments may be shown as answers.

Hierarchical Grid with HeaderCheckbox

2 Answers 58 Views
GridView
This is a migrated thread and some comments may be shown as answers.
florian
Top achievements
Rank 1
florian asked on 08 Dec 2017, 10:34 AM

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.

 

2 Answers, 1 is accepted

Sort by
0
Accepted
Dess | Tech Support Engineer, Principal
Telerik team
answered on 12 Dec 2017, 08:18 AM
Hello, Florian,

Thank you for writing.  

I have logged it in our feedback portal. You can track its progress, subscribe for status changes and add your comments on the following link - feedback item.

I have also updated your Telerik points.

Currently, the possible solution that I can suggest is to use a custom GridCheckBoxHeaderCellElement which is demonstrated in the referred feedback item.

I hope this information helps. Should you have further questions I would be glad to help.

 Regards,
Dess
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
florian
Top achievements
Rank 1
answered on 13 Dec 2017, 10:52 AM
Thank you so much for your feedback and your workaround 
Tags
GridView
Asked by
florian
Top achievements
Rank 1
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
florian
Top achievements
Rank 1
Share this question
or