Problem Drawing right border for Merged Cells

I''m drawing left and right borders to display edges for groups of columns. The column headers are done via a merge and I set the left and right border of cells based on whether or not they are the most Left or most Right cell in a range. Everything seems to be working fine except for the merged cells at the top. The right border does not seem to show up. Code snippets are below any help would be appreciated. Thanks Brian GridRangeInfo rangeInfo = getRangeInfoForGridColumn(e.ColIndex -1); if ((rangeInfo != null) && (rangeInfo.Left <= e.ColIndex - 1) && (rangeInfo.Right >= e.ColIndex - 1)) { applyGroupBorderStyle(gridColumn.DataGridColumnGroup, e.Style); e.Style.MergeCell = GridMergeCellDirection.ColumnsInRow; e.Style.CellValue = getColumnGroupCaption(gridColumn); } -- int colIndex = style.CellIdentity.ColIndex - 1; if (colIndex == range.Left) { style.Borders.Left = new GridBorder(GridBorderStyle.Solid, columnGroup.BorderColor); } else if(colIndex == range.Right) { style.Borders.Right = new GridBorder(GridBorderStyle.Solid, columnGroup.BorderColor); }

mergeborder.zip

1 Reply

AD Administrator Syncfusion Team March 3, 2006 05:50 PM UTC

Hi Brain, The merge cell is spanned over the cells under them. So, you have to set right border property to same cell that starts from left. ================================= For Example: | 1 |* | 2 | 3 |+ The 1 cell is merged from 2 cell to 3 cell. To have border property on ''*'', then set right border for 1 cell. For ''+'' set property to 3 cell ================================= Here is the modified code. ----- if (colIndex == range.Left) { style.Borders.Left = new GridBorder(GridBorderStyle.Solid, columnGroup.BorderColor); if( rowIndex == 0) style.Borders.Right = new GridBorder(GridBorderStyle.Solid, columnGroup.BorderColor); } else if(colIndex == range.Right) { style.Borders.Right = new GridBorder(GridBorderStyle.Solid, columnGroup.BorderColor); } Let us know if you need further assistance, Best Regards, Madhan.

Loader.
Up arrow icon