Hiding a Group Header When value is empty

3 posts, 0 answers
  1. Jeff
    Jeff avatar
    38 posts
    Member since:
    Jan 2008

    Posted 19 Jan 2010 Link to this post

    There are a couple of other posts related to hiding a Group Header but I believe this circumstance is a bit different.

     

    We have a hierarchical Grid with the following levels:

    Track > Course > Lesson

     

    The Lessons within a course are then grouped by Chapters. But some of the courses have no chapters - just a series of lessons. In those cases we want to hide the group header. It is not a case where there are no items, it is just that the related chapter grouping is "null".

    Is there a way to check that if the group value that is returned is "null" (or a specific value if that is easier) and then hide the group header and expand/collapse button if that is the case?

    thanks

  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 20 Jan 2010 Link to this post

    Hello Jeff,

    You can try out the following example to hide the GroupHeaderItem when it displays no value:
    c#:
    protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) 
        { 
            if (e.Item is GridGroupHeaderItem) 
            { 
                GridGroupHeaderItem gpHeader = e.Item as GridGroupHeaderItem;   
                if(gpHeader.DataCell.Text.Substring(gpHeader.DataCell.Text.IndexOf(":") + 1) == " "
                { 
                    gpHeader.Display = false
                } 
            } 
        }  

    Thanks
    Princy.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Jeff
    Jeff avatar
    38 posts
    Member since:
    Jan 2008

    Posted 20 Jan 2010 Link to this post

    Thanks - that worked great
Back to Top