Home Forums WinForms controls Xceed Grid for WinForms Xceed Grid for .Net Programmatically Grouping Data

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #16681 |

    Hello there,

    I have searched the forums but haven’t been able to find anything talking about how to programmatically group a grid and disallow the user to dynamically group the data presented. I found an answer to a similar question but it wasn’t exactly what I was looking for and was also in C. I am using VB so if you can help out please use examples in visual basic. If I haven’t provided enough info just let me know what else you need to know and I’ll provide it.

     

    Thanks

    Imported from legacy forums. Posted by Jeff (had 1540 views)

    User (Old forums)
    Member
    Post count: 23064

    Well, I’ve found some code in the documentation that should work but fomr some reason I still can’t get the grid to group for me. I have included some code this time. If any of you can see what I am doing wrong I would appreciate the help.

     Thanks,

    Private

    Sub WorkStations_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    Dim objConn As OleDbConnection = New OleDbConnection(“Server=HRCANVSOPS\OPSTORE1;uid=*******;pwd=*******;database=OSP; Application Name=OSP;Provider=SQLOLEDB”)

    Dim DataRead As New DataSet

    Dim cmdData As OleDbDataAdapter = New OleDbDataAdapter(“Select OfficeID, DistrictIk, NumWorkStations, BusinessTypeID, CreatedBy, CreatedDate From OfficeWorkStations”, objConn)

    cmdData.Fill(DataRead,

    “WrkStations”)

    Dim cb As New OleDbCommandBuilder(cmdData)

    cmdData.InsertCommand = cb.GetInsertCommand()

    cmdData.DeleteCommand = cb.GetDeleteCommand()

    cmdData.UpdateCommand = cb.GetUpdateCommand()

    GridControl1.DataSource = DataRead

    GridControl1.DataMember =

    “WrkStations”

    Dim group As New Group()

    group.GroupBy =

    “DistrictIk”

    group.HeaderRows.Add(

    New GroupManagerRow())

    GridControl1.GroupTemplates.Add(group)

    GridControl1.GroupTemplates.Add(

    New Group(“DistrictIk”))

     

    End Sub

    Imported from legacy forums. Posted by Jeff (had 511 views)

    User (Old forums)
    Member
    Post count: 23064

    Ok, I figured it out… What they don’t tell you in the documentaton is that if your grid already contains data you need to call

    GridControl1.UpdateGrouping()

     Anyway, hopfully this helps someone out.

     

    Imported from legacy forums. Posted by Jeff (had 776 views)

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.