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. Image for the cookie policy date

Split column header in Grid Grouping Control

Hi, We have a requirement to display the column header as attached in the file. To achieve this we are using the following code. GridColumnSetDescriptor gridColumnSetDescriptor = new GridColumnSetDescriptor(); gridColumnSetDescriptor.ColumnSpans.AddRange( new Syncfusion.Windows.Forms.Grid.Grouping.GridColumnSpanDescriptor[] { new Syncfusion.Windows.Forms.Grid.Grouping.GridColumnSpanDescriptor("CASH", "R0C0:R0C1"); syncGrid.TableDescriptor.ColumnSets.Add(gridColumnSetDescriptor); But it is adding extra rows to the rows also. We want to display for only columns. How to handle this in Grid Grouping Control. Thanks & Regards, Prathima.

pic20033.zip

3 Replies

ST stanleyj Syncfusion Team February 18, 2006 11:30 AM UTC

Hi Prathima, The ColumnSets are used for diplaying the rows in a multi row fashion, therefore it is quite not possible to have only the header cells multirows and the record field as single row. However using QueryCellStyleInfo, the border style for the bottom of that cell can be removed and a similar dotted image as of standard GridBorderStyle can be placed in that cell. Also disable that cell so that the user do not move over there. To the rest of the columns set VerticalAlignment to Bottom, so that the text are placed uniformly. private void gridGroupingControl1_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e) { if(e.TableCellIdentity.Column != null) if(e.TableCellIdentity.Column.Name == "Cash" &&( e.TableCellIdentity.TableCellType == GridTableCellType.RecordFieldCell || e.TableCellIdentity.TableCellType == GridTableCellType.AlternateRecordFieldCell)) { e.Style.Borders.Bottom = new GridBorder(GridBorderStyle.None); e.Style.CellType = "Image"; e.Style.CellValue = bmp; e.Style.Enabled = false; } else if(e.TableCellIdentity.Column.Name != "Cash") { e.Style.VerticalAlignment = GridVerticalAlignment.Bottom; } } Best regards, Stanley


PV Prathima Venkobachar February 20, 2006 08:35 AM UTC

Hi, Thanks for your reply. One more query we are having regarding the same. As you mentioned,we assigned a image with vertical dotted lines in the middle to that cell. Now our problem is if the column header is dragged, then the image is not stretched. So the vertical alignment is not proper. Give us some solution for this. Regards, Prathima. >Hi Prathima, > >The ColumnSets are used for diplaying the rows in a multi row fashion, therefore it is quite not possible to have only the header cells multirows and the record field as single row. However using QueryCellStyleInfo, the border style for the bottom of that cell can be removed and a similar dotted image as of standard GridBorderStyle can be placed in that cell. Also disable that cell so that the user do not move over there. To the rest of the columns set VerticalAlignment to Bottom, so that the text are placed uniformly. > > > private void gridGroupingControl1_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e) > { > if(e.TableCellIdentity.Column != null) > if(e.TableCellIdentity.Column.Name == "Cash" &&( e.TableCellIdentity.TableCellType == GridTableCellType.RecordFieldCell || e.TableCellIdentity.TableCellType == GridTableCellType.AlternateRecordFieldCell)) > { > e.Style.Borders.Bottom = new GridBorder(GridBorderStyle.None); > e.Style.CellType = "Image"; > e.Style.CellValue = bmp; > e.Style.Enabled = false; > } > else if(e.TableCellIdentity.Column.Name != "Cash") > { > e.Style.VerticalAlignment = GridVerticalAlignment.Bottom; > } > } > > >Best regards, >Stanley

Pics0.zip


ST stanleyj Syncfusion Team February 20, 2006 02:46 PM UTC

Hi Prathima, If you have troubles while resizing, then you may prefer querying both the sub columns to be equal and have resizing with Cash or This order column. this.gridGroupingControl1.TableControl.Model.QueryColWidth += new GridRowColSizeEventHandler(Model_QueryColWidth); private void Model_QueryColWidth(object sender, GridRowColSizeEventArgs e) { if(e.Index == 1) //Yesterday Column e.Size = this.gridGroupingControl1.TableModel.ColWidths[2];// Cash Column } Best regards, Stanley

Loader.
Live Chat Icon For mobile
Up arrow icon