Hierarchical Grid with HeaderCheckbox

3 posts, 1 answers
  1. florian
    florian avatar
    15 posts
    Member since:
    Nov 2017

    Posted 08 Dec 2017 Link to this post

    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. Answer
    Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    3216 posts

    Posted 12 Dec 2017 Link to this post

    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.
  3. florian
    florian avatar
    15 posts
    Member since:
    Nov 2017

    Posted 13 Dec 2017 in reply to Dess | Tech Support Engineer, Sr. Link to this post

    Thank you so much for your feedback and your workaround 
Back to Top