3 Answers, 1 is accepted
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.
Dess
Telerik
Thanks Dess for your prompt response and help.
regards
arvind
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.
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.
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.