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

How to create grid with multiple header

3 Answers 917 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
arvind
Top achievements
Rank 1
arvind asked on 11 Aug 2015, 06:36 AM

Dear Support,

How can I implement grid with multiple headers or like child header. Any live example or code snipped will be appreciated.

thanks

arvind

3 Answers, 1 is accepted

Sort by
0
arvind
Top achievements
Rank 1
answered on 11 Aug 2015, 06:46 AM
Sample grid attached with post.
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 11 Aug 2015, 06:52 AM
Hello Arvind,

Thank you for writing.

RadGridView supports view definitions which allow you to define multi-row headers. Please have a look at the View Definitions section in the online documentation. You can refer to our Demo application which comes with the installation of the Telerik UI for WinForms suite >> GridView >> Columns >> Grid Views example. It is usually located at the following location: C:\Program Files (x86)\Telerik\UI for WinForms Q2 2015\Examples\QuickStart\bin.

I hope this information helps. Should you have further questions I would be glad to help.
 
Regards,
Dess
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
arvind
Top achievements
Rank 1
answered on 11 Aug 2015, 07:05 AM

Thanks Dess for your prompt response and help.

regards

arvind

 

Michael
Top achievements
Rank 1
Iron
Iron
Veteran
commented on 18 Aug 2021, 11:20 AM

I don't see how one can add columns of varying types.  I have, for example, a GridViewComboBoxColumn, a GridViewDateTimeColumn and others.
Dess | Tech Support Engineer, Principal
Telerik team
commented on 18 Aug 2021, 12:57 PM

Hello, Michael,

RadGridView offers different columns which are specifically designed to manage certain data types, e.g. integer/decimal (GridViewDecimalColumn), string (GridViewTextBoxColumn), DateTime. Each of the columns uses an appropriate editor for managing the respective cell's Value. 

If you need to add a column varying types, you can use a GridViewTextBoxColumn and handle the EditorRequired event where you can specify what editor will be used considering the current cell's data type. Please refer to the following help article:
https://docs.telerik.com/devtools/winforms/controls/gridview/editors/how-to/change-the-active-editor-depending-on-the-cell-value-type. 

An alternative solution is to use different cell elements within the same column. A sample approach is demonstrated in the following forum thread:
https://www.telerik.com/forums/different-cell-type 

Feel free to use this approach which suits your requirements best.
Michael
Top achievements
Rank 1
Iron
Iron
Veteran
commented on 18 Aug 2021, 01:04 PM

Thanks for the quick response, but it's not clear to me that we're talking about the same thing:  I asked about different column types in the context of this thread, which is about column groups.  I've seen the code for creating column groups and it seems that one can only add columns by adding their captions, which implies to me that those are all regular text columns.  I'm looking for a way to group columns (so that I can get multiple header rows) but for the columns themselves to be of various types.

Was that clear from my question, and is your suggestion that the only way for me to do it in the context of column groups is to override the cell editors?

Thanks.

Dess | Tech Support Engineer, Principal
Telerik team
commented on 18 Aug 2021, 01:13 PM

Thank you for the clarification, Michael. Now, I got better understanding about the precise case. 

You can use columns of any types when defining a certain view definition in the grid. You are not limited to GridViewTextBoxColumns only. You can use all column types in your RadGridView. Once the columns are added to the grid either automatically by data binding or programmatically by managing the RadGridView.Columns collection, you can then define the view definition instance using the column names as it is demonstrated in the following help articles:

https://docs.telerik.com/devtools/winforms/controls/gridview/view-definitions/column-groups-view  

https://docs.telerik.com/devtools/winforms/controls/gridview/view-definitions/html-view 

Note that in the code snippets in these articles you are not adding grid columns, you are just defining column names in the view definition. Using these names, the respective view definition connects to the respective grid column object.

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