Not able to see anything when used with column groups

6 posts, 0 answers
  1. harsha
    harsha avatar
    5 posts
    Member since:
    Jun 2017

    Posted 03 Aug Link to this post

    HI,

       I am trying to create gridview like Example.png. I tried with project examplepng but nothing is coming to UI. Can you please tell me why? What needs to be done to fix it?

    Note: Sorry i didn't know how to attach project iteself.

     

    Regards

    Harsha D

     

     

  2. Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    3895 posts

    Posted 04 Aug Link to this post

    Hello, Harsha,

    I would recommend you to have a look at the following help article demonstrating how to properly setup a ColumnGroupsViewDefinitionhttps://docs.telerik.com/devtools/winforms/controls/gridview/view-definitions/column-groups-view 

    Note that most of the forum threads are reviewed by Telerik representatives and sometimes we address the questions asked by our customers in the forums as well. However, a post in the forum doesn't guarantee you a response from the Telerik support team. Moreover, threads are handled according to license and time of posting, so if it is an urgent problem or you want to attach a sample project, we suggest you use a support ticket, which would be handled before a forum thread and it is entitled with 24 hours response time.

    Thank you for your understanding.

    Regards,
    Dess | Tech Support Engineer, Sr.
    Progress Telerik

  3. harsha
    harsha avatar
    5 posts
    Member since:
    Jun 2017

    Posted 04 Aug in reply to Dess | Tech Support Engineer, Sr. Link to this post

    HI Dess,

         Actually i took the same example if you see my Project Example.png. I was confused that why its not working. So i posted question.

     

    Regards

    Harsha D

  4. Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    3895 posts

    Posted 04 Aug Link to this post

    Hello, Harsha,

    According to the provided screenshots, it seems that your code is a bit different than the one referred in the help article. Instead of adding to the ColumnNames collection,  you are adding to the Columns collection which I suppose is the reason for not obtaining the desired output. Do you have any columns added to RadGridView?

    Back in the beginning of 2016 we removed all obsolete properties for the GridViewColumnGroupRow, e.g. the Columns collection (Obsolete as of Q2 2015). It was announced to use the ColumnNames collection instead.

    I have prepared a sample project for your reference. Please give it a try and see how it works on your end.

    Regards,
    Dess | Tech Support Engineer, Sr.
    Progress Telerik

  5. harsha
    harsha avatar
    5 posts
    Member since:
    Jun 2017

    Posted 04 Aug in reply to Dess | Tech Support Engineer, Sr. Link to this post

    HI Dess,

       I am using version 2014.3.1202.20, may be thats why. Is there any workaround for this in the version which i am using?

     

    Regards

    Harsha D

  6. Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    3895 posts

    Posted 04 Aug Link to this post

    Hi, Harsha,

    I would highly encourage you to upgrade to as latest version as possible in order to benefit from all the introduced improvements affecting the view definitions in RadGridView.

    However, for the specified version (2014.3.1202) you can find below the relevant code:

                this.customersTableAdapter.Fill(this.nwindDataSet.Customers);
    
                this.radGridView1.AutoGenerateColumns = true;
                this.radGridView1.DataSource = this.customersBindingSource;
                this.radGridView1.BestFitColumns();
                 
                ColumnGroupsViewDefinition view = new ColumnGroupsViewDefinition();
                view.ColumnGroups.Add(new GridViewColumnGroup("Customer Contact"));
                view.ColumnGroups.Add(new GridViewColumnGroup("Details"));
                view.ColumnGroups[1].Groups.Add(new GridViewColumnGroup("Address"));
                view.ColumnGroups[1].Groups.Add(new GridViewColumnGroup("Contact"));
                view.ColumnGroups[0].Rows.Add(new GridViewColumnGroupRow());
                view.ColumnGroups[0].Rows[0].Columns.Add(this.radGridView1.Columns["CompanyName"]);
                view.ColumnGroups[0].Rows[0].Columns.Add(this.radGridView1.Columns["ContactName"]);
                view.ColumnGroups[0].Rows[0].Columns.Add(this.radGridView1.Columns["ContactTitle"]);
                view.ColumnGroups[1].Groups[0].Rows.Add(new GridViewColumnGroupRow());
                view.ColumnGroups[1].Groups[0].Rows[0].Columns.Add(this.radGridView1.Columns["Address"]);
                view.ColumnGroups[1].Groups[0].Rows[0].Columns.Add(this.radGridView1.Columns["City"]);
                view.ColumnGroups[1].Groups[0].Rows[0].Columns.Add(this.radGridView1.Columns["Country"]);
                view.ColumnGroups[1].Groups[1].Rows.Add(new GridViewColumnGroupRow());
                view.ColumnGroups[1].Groups[1].Rows[0].Columns.Add(this.radGridView1.Columns["Phone"]);
                view.ColumnGroups[1].Groups[1].Rows[0].Columns.Add(this.radGridView1.Columns["Fax"]);
                radGridView1.ViewDefinition = view;

    I hope this information helps.

    Regards,
    Dess | Tech Support Engineer, Sr.
    Progress Telerik

Back to Top