We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How can i place a sub-columns inside a datatable column???

Thread ID:





71098 Jan 15,2008 12:24 PM UTC Jan 28,2008 07:27 AM UTC WinForms 3
Tags: Grouping
Daniel Santos de Carvalho
Asked On January 15, 2008 12:24 PM UTC

I wanted to place a column (days) in my datatable with many sub-columns inside it. Each of this sub-columns will have a different day with different data inside. Any idea how to place a column inside other???

Jeba S [Syncfusion]
Replied On January 23, 2008 11:52 AM UTC

Hi Daniel,

Sorry for the delay in response.

You need to use the custom cell type for storing the different value in a single cell. It requires a model class and a renderer
class. The model class handles the serialization requirements for the control and creates the renderer class. The renderer
class handles the UI requirements of the cell. Then to use the custom cell type in a grid, you need to register this celltype
with the grid. Below is the code snippets:

this.gridGroupingControl1.TableModel.CellModels.Add("TwoTextBoxCell", new TwoTextBoxCellModel(this.gridGroupingControl1.TableModel));
this.gridGroupingControl1.TableDescriptor.Columns["Customers"].Appearance.AnyRecordFieldCell.CellType = "TwoTextBoxCell";

Please refer this sample that implements the split column cell type.

It implements the GridGenericControlCellModel and GridGenericControlCellRenderer for creating a custom cell type in a grid.

Kindly let us know if you need any further assistance.

Best Regards,

Daniel Santos de Carvalho
Replied On January 25, 2008 07:01 PM UTC

Actually, i'm looking for something that allow the "colspan" effect of the html in the header.

There is a way to put a text that take the header space of many columns??

Jeba S [Syncfusion]
Replied On January 28, 2008 07:27 AM UTC

Hi Daniel,

Thank you for your update.

You can achieve the column spanning of header by handling the QueryCoveredRange event. Here is the code snippet that shows merging a range of columns using QueryCoveredRange event.

int col1 = 3,col2 = 4;
private void gridGroupingControl1_QueryCoveredRange(object sender, GridTableQueryCoveredRangeEventArgs e)
GridTable thisTable = this.gridGroupingControl1.Table;
if (e.RowIndex < thisTable.DisplayElements.Count)
Element el = thisTable.DisplayElements[e.RowIndex];
if(el.Kind == DisplayElementKind.ColumnHeader)//.Record)
if(e.ColIndex >= col1 && e.ColIndex <= col2)
e.Range = GridRangeInfo.Cells(e.RowIndex, col1, e.RowIndex, col2);
e.Handled = true;

Please refer to the attached sample that illustrates the same:

Kindly let us know if you need any further assistance.

Best regards,


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon