Grid Group

2 posts, 0 answers
  1. Stim24
    Stim24 avatar
    6 posts
    Member since:
    Apr 2013

    Posted 05 Sep Link to this post

    How progamming grouping colum in radgridview?
    I have this grid (picture "grid_now.jpg")
    Need to do (picture "grid_needow.jpg")

    Programm code :
    this.columnGroupsView = new ColumnGroupsViewDefinition();<br><br>            this.columnGroupsView.ColumnGroups.Add(new GridViewColumnGroup("group1"));<br>            this.columnGroupsView.ColumnGroups[0].Groups.Add(new GridViewColumnGroup("h1"));<br>            this.columnGroupsView.ColumnGroups[0].Groups[0].Rows.Add(new GridViewColumnGroupRow());<br>            this.columnGroupsView.ColumnGroups[0].Groups[0].Rows[0].ColumnNames.Add("column1");<br>            this.columnGroupsView.ColumnGroups.Add(new GridViewColumnGroup("group2"));<br>            this.columnGroupsView.ColumnGroups[1].Groups.Add(new GridViewColumnGroup("h1"));<br>            this.columnGroupsView.ColumnGroups[1].Groups[0].Rows.Add(new GridViewColumnGroupRow());<br>            this.columnGroupsView.ColumnGroups[1].Groups[0].Rows[0].ColumnNames.Add("column2");<br>            this.columnGroupsView.ColumnGroups[1].Groups[0].Rows.Add(new GridViewColumnGroupRow());<br>            this.columnGroupsView.ColumnGroups[1].Groups[0].Rows[1].ColumnNames.Add("column3");<br><br>            this.radGridView1.ViewDefinition = columnGroupsView;<br>
    not work(
  2. Dimitar
    Admin
    Dimitar avatar
    2790 posts

    Posted 06 Sep Link to this post

    Hello Tim,

    There is no need to add the second groups. Here is how you can change the code:

    public RadForm1()
    {
        InitializeComponent();
        var columnGroupsView = new ColumnGroupsViewDefinition();
        columnGroupsView.ColumnGroups.Add(new GridViewColumnGroup("group1"));
        columnGroupsView.ColumnGroups.Add(new GridViewColumnGroup("group2"));
    
        columnGroupsView.ColumnGroups[0].Rows.Add(new GridViewColumnGroupRow());
        columnGroupsView.ColumnGroups[0].Rows[0].ColumnNames.Add("column1");
         
        columnGroupsView.ColumnGroups[1].Rows.Add(new GridViewColumnGroupRow() { MinHeight = 30 });
        columnGroupsView.ColumnGroups[1].Rows[0].ColumnNames.Add("column2");
    
        columnGroupsView.ColumnGroups[1].Rows.Add(new GridViewColumnGroupRow() { MinHeight = 30 });
        columnGroupsView.ColumnGroups[1].Rows[1].ColumnNames.Add("column3");
    
        this.radGridView1.ViewDefinition = columnGroupsView;
    
        radGridView1.Columns.Add("column1");
        radGridView1.Columns.Add("column2");
        radGridView1.Columns.Add("column3");
    
    
    }
    

    I hope this helps. Should you have any other questions, do not hesitate to ask.

    Regards,
    Dimitar
    Progress Telerik

    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top