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

Problem with column common Header

3 Answers 84 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Aurélien
Top achievements
Rank 1
Aurélien asked on 29 Mar 2012, 02:21 PM
Hi,
I have a problem when using commom column header, I got a null reference exception,
I'm using pdb files to debug telerik gridviiew dll and exception occurs in CommonHeaderPresenter Class and ArrangeLowestHeaders() method.

private void ArrangeLowestHeaders()
        {
 
 
            string lastGroupName = String.Empty;
            CommonColumnHeader lastCommonHeader = null;
            int span = 0;
 
            List<CommonColumnHeader> headers = new List<CommonColumnHeader>();
            for (int i = 0; i < this.OrderedColumns.Count; i++)
            {
                string groupName = this.OrderedColumns[i].ColumnGroupName;
 
                if (lastGroupName != groupName)
                {
                    lastGroupName = groupName;
                    span = 0;
 
                    CommonColumnHeader commonHeader = CreateCommonHeader();
                    this.CommonHeadersGrid.Children.Add(commonHeader);
                    var group = FindGroupByName(groupName, this.ColumnGroups);
                    commonHeader.ColumnGroup = group;
                    commonHeader.Content = CommonHeaderPresenter.GetContent(group);//TODO  this should happen in the header itself.
                    SetTemplateAndStyle(commonHeader, group);
                    commonHeader.SetValue(Grid.ColumnProperty, i);
                    commonHeader.SetValue(Grid.RowProperty, this.RowCount - 1);
                    commonHeader.HorizontalAlignment = HorizontalAlignment.Stretch;
                    headers.Add(commonHeader);
                    lastCommonHeader = commonHeader;
                }
 
                span++;
                lastCommonHeader.SetValue(Grid.ColumnSpanProperty, span);
                if (gridView.FrozenColumnCount > 0)
                {
                    SelectiveScrollingGrid.SetSelectiveScrollingOrientation(lastCommonHeader, SelectiveScrollingOrientation.Vertical);
                }
            }
 
            if (RowCount > 1)
            {
                ArrangeHeadersAtRow(this.RowCount - 2, headers);
            }
        }


To get this bug , set  ColumnGroupName property of the first column of your grid to string.empty or set the first groupName to string empty.
Because lastGroupName = groupName = string.empty,
lastCommonHeader is not initialized and you have a null reference exception at line 142.


3 Answers, 1 is accepted

Sort by
0
Pavel Pavlov
Telerik team
answered on 29 Mar 2012, 03:02 PM
Hi ,

Our QA guys are trying to reproduce the problem you are experiencing. Can you please share the version of Telerik DLLs that you are using so we can be sure to test with the same ?

Greetings,
Pavel Pavlov
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Aurélien
Top achievements
Rank 1
answered on 29 Mar 2012, 03:07 PM
gridview dll version is 2012.1.326.40.
I downloaded the latest version this week.
0
Pavel Pavlov
Telerik team
answered on 03 Apr 2012, 02:57 PM
Hello Aurelien,

Please excuse me for the delayed answer. I wanted to be sure this was addressed. We have managed to reproduce the error. We have applied the fixes neccessary. The very next latest internal build will contain the updates.

Thank you for the productive feedback on this issue! I am updating your telerik points.

Kind regards,
Pavel Pavlov
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
Tags
GridView
Asked by
Aurélien
Top achievements
Rank 1
Answers by
Pavel Pavlov
Telerik team
Aurélien
Top achievements
Rank 1
Share this question
or