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

the GroupingDescriptors Programmatically does not work in Q3 2010

6 Answers 156 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Fernando
Top achievements
Rank 1
Fernando asked on 20 Nov 2010, 03:59 PM
Hi, i use the next GroupingDescriptors

Dim descriptor As New GroupDescriptor()
descriptor.GroupNames.Add("COLOR", ListSortDirection.Ascending)
Me.RGViewPO.GroupDescriptors.Add(descriptor)

and in the Q2 2010 work perfect but in Q3 2010 does not work
this is a big problem to me and need fix Immediately, my users have complained since the update and do not want to go back to Q2
I attach two print screen, the first is the RadGridView with the release Q2, The Grouping by color is perfect
the Second is the same RadGridView with the release Q3 but the makes the clustering based on the first column of the table and not by the color column

6 Answers, 1 is accepted

Sort by
0
Accepted
Richard Slade
Top achievements
Rank 2
answered on 20 Nov 2010, 05:15 PM
Hello Fernando,

I haven't been able to replicate this issue. I have put together a simple exmaple using a person class and I can add a group descriptor which displays correctly. Please can you try the sample below. This is just a RadGridView on a form.

Imports Telerik.WinControls
Imports Telerik.WinControls.UI
Imports System.Globalization
  
  
Imports Telerik.WinControls.Data
Imports Telerik.WinControls.UI.Grid
  
Public Class Form1
  
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  
        Dim list As New List(Of person)
        list.Add(New person("Richard", 1))
        list.Add(New person("Bob", 2))
        list.Add(New person("Stewart", 3))
        list.Add(New person("Chris", 4))
        list.Add(New person("Leisl", 1))
        list.Add(New person("Tom", 5))
        list.Add(New person("Oly", 6))
  
        Me.RadGridView1.DataSource = list
  
        Dim group As New GroupDescriptor()
        group.GroupNames.Add("Name", System.ComponentModel.ListSortDirection.Ascending)
        Me.RadGridView1.GroupDescriptors.Add(group)
  
    End Sub
  
End Class
  
Public Class person
    Private m_Id As Integer
    Private m_Name As String
  
    Public Sub New()
    End Sub
  
    Public Sub New(ByVal name As String, ByVal id As Integer)
        m_Name = name
        m_Id = id
    End Sub
  
    Public Property Name() As String
        Get
            Return m_Name
        End Get
        Set(ByVal value As String)
            m_Name = value
        End Set
    End Property
  
    Public Property Id() As Integer
        Get
            Return m_Id
        End Get
        Set(ByVal value As Integer)
            m_Id = value
        End Set
    End Property
  
End Class

Look forward to hearing back from you.
Richard
0
Richard Slade
Top achievements
Rank 2
answered on 22 Nov 2010, 02:34 PM
Hello,

How did you get on with this? If it helped, please remember to mark as answer. If you need more assistance, please just let me know.
thanks
Richard
0
Fernando
Top achievements
Rank 1
answered on 22 Nov 2010, 09:33 PM
thanks for taking the time to answer my problem is that if I group by a column other than the first, does not work because it only brings me the contents of the first column, in the case to explain the column of color don't is the first, then if I made the grouping but always taking the first though I specified to be that of color.
I was testing what I sent and it worked but when I did what I would group by the number and not by the nommbre of person, always followed by grouping by name: (
0
Accepted
Richard Slade
Top achievements
Rank 2
answered on 22 Nov 2010, 09:52 PM
Hello Fernando,

I'm not sure if I understand you correctly. you are saying that you have a problem when you group by a column that is not the first column? Is that correct?

I have extended the simple sample to introduce an additinoal column, and also include a NULL value, and all grouping behaves correctly.

If you would like to try the sample I have incuded it below. If you find that this works correctly, please post a sample that replicates your situation so I can help further.
Many thanks
Richard

Imports Telerik.WinControls
Imports Telerik.WinControls.UI
Imports Telerik.WinControls.Data
Imports Telerik.WinControls.UI.Grid
  
Public Class Form1
  
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  
        Dim list As New List(Of person)
        list.Add(New person("Richard", 1, "New Milton"))
        list.Add(New person("Bob", 2, "London"))
        list.Add(New person("Stewart", 3, "Bournemouth"))
        list.Add(New person("Chris", 4, "Southampton"))
        list.Add(New person("Leisl", 1, "Christcurch"))
        list.Add(New person("Tom", 5, "Weymouth"))
        list.Add(New person("Oly", 6, Nothing))
  
        Me.RadGridView1.DataSource = list
  
        Dim group As New GroupDescriptor()
        group.GroupNames.Add("City", System.ComponentModel.ListSortDirection.Ascending)
        Me.RadGridView1.GroupDescriptors.Add(group)
  
    End Sub
  
End Class
  
Public Class person
    Private m_Id As Integer
    Private m_Name As String
    Private m_City As String
  
    Public Sub New()
    End Sub
  
    Public Sub New(ByVal name As String, ByVal id As Integer, ByVal city As String)
        m_Name = name
        m_Id = id
        m_City = city
    End Sub
  
    Public Property City() As String
        Get
            Return m_City
        End Get
        Set(ByVal value As String)
            m_City = value
        End Set
    End Property
  
    Public Property Name() As String
        Get
            Return m_Name
        End Get
        Set(ByVal value As String)
            m_Name = value
        End Set
    End Property
  
    Public Property Id() As Integer
        Get
            Return m_Id
        End Get
        Set(ByVal value As Integer)
            m_Id = value
        End Set
    End Property
  
End Class

0
Fernando
Top achievements
Rank 1
answered on 22 Nov 2010, 10:06 PM
I solved my problem...

Each time you add a new record to the dataset I commanded to expand all the groups with the following code

Me.RadGridView.MasterTemplate.AutoExpandGroups = True

and for some reason that is why I grouped well
since then it occurred to me to send so refreshing mastertemplate

Me.RadGridView.MasterTemplate.Refresh ()

and ready! now if I grouped correctly.
Thank you very much, honestly this is the first forum I know of where a company helps the developers, I congratulate you and look forward to learning more here.

Telerik is the best!
0
Richard Slade
Top achievements
Rank 2
answered on 22 Nov 2010, 10:38 PM
Hi Fernando,

I'm delighted that has worked for you. Let me know if you need anything further.

Regards,
Richard
Tags
GridView
Asked by
Fernando
Top achievements
Rank 1
Answers by
Richard Slade
Top achievements
Rank 2
Fernando
Top achievements
Rank 1
Share this question
or