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

Not able to see anything when used with column groups

5 Answers 36 Views
GridView
This is a migrated thread and some comments may be shown as answers.
harsha
Top achievements
Rank 1
harsha asked on 04 Aug 2020, 04:41 AM

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

 

 

5 Answers, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 04 Aug 2020, 06:01 AM

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

0
harsha
Top achievements
Rank 1
answered on 04 Aug 2020, 10:36 AM

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

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 04 Aug 2020, 11:00 AM

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

0
harsha
Top achievements
Rank 1
answered on 04 Aug 2020, 11:11 AM

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

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 05 Aug 2020, 04:54 AM

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

Tags
GridView
Asked by
harsha
Top achievements
Rank 1
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
harsha
Top achievements
Rank 1
Share this question
or