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

Hierarchical gridview problems

1 Answer 88 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Peter Szintai
Top achievements
Rank 1
Peter Szintai asked on 17 Nov 2010, 10:08 PM
Hi All,

In our WinForms application we have some hierarchival gridviews (we call them master-detail grid). This week we upgraded to the new 2010.3 10.1109 version, the last version was the 2010.2 10.914, and the application worked fine with the older verion.

But, now:
In the UserAddedRow event the e.Row.Hierarchilevel is 1 always, and not 0 in the case of new master rows.

In the UserDeletedRow event the e.Row.DataBoundItem is null, so, e.g.: e.Row.DataBoundItem.GetType().Name throws a NullReferenceException.

Any idea?


Best regards,

Peter Szintai

1 Answer, 1 is accepted

Sort by
0
Accepted
Richard Slade
Top achievements
Rank 2
answered on 17 Nov 2010, 11:27 PM
Hello Peter,

I've tried this out and it seems as though it's true.
If you only have a parent / child relationship, then you could try something like this to get your 0/1 hierarchy level

Private Sub RadGridView1_UserAddedRow(ByVal sender As System.Object, _
    ByVal e As Telerik.WinControls.UI.GridViewRowEventArgs) Handles RadGridView1.UserAddedRow
    If e.Row.ViewTemplate Is Me.RadGridView1.MasterTemplate Then
        MessageBox.Show("0")
    Else
        MessageBox.Show("1")
    End If
    'MessageBox.Show(e.Row.HierarchyLevel.ToString())
End Sub

and the UserDeletingRow event still has the databound object
Private Sub RadGridView1_UserDeletingRow(ByVal sender As System.Object, _
    ByVal e As Telerik.WinControls.UI.GridViewRowCancelEventArgs) Handles RadGridView1.UserDeletingRow
    MessageBox.Show(e.Rows(0).DataBoundItem.ToString())
End Sub

hope that helps, but let me know if you need more information

Richard
Tags
GridView
Asked by
Peter Szintai
Top achievements
Rank 1
Answers by
Richard Slade
Top achievements
Rank 2
Share this question
or