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.
Unfortunately, activation email could not send to your email. Please try again.

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

Thread ID:

Created:

Updated:

Platform:

Replies:

71098 Jan 15,2008 07:24 AM Jan 28,2008 02:27 AM Windows Forms 3
loading
Tags: Grouping
Daniel Santos de Carvalho
Asked On January 15, 2008 07:24 AM

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 06:52 AM

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.
http://websamples.syncfusion.com/samples/Grid.Windows/F71098/main.htm

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,
Jeba.






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

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 02:27 AM

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:
http://websamples.syncfusion.com/samples/Grid.Windows/F71098New/main.htm

Kindly let us know if you need any further assistance.

Best regards,
Jeba.



CONFIRMATION

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.

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.

;