merging cells

I would like to set the merge properties of a column to true so that cells with same values get merged in that column. ditto for a row. mHow do i do that for a unbound essential grid. also, How do i display my text in the centre row of a covered range? I am new to grids and also to .net and also to VB

18 Replies

AD Administrator Syncfusion Team September 23, 2004 02:54 PM UTC

Hi Mahesh, First you need to set Options.MergeCellsMode = GridMergeCellsMode.OnDemandCalculation|GridMergeCellsMode.MergeRowsInColumn|GridMergeCellsMode.MergeColumnsInRow; then for individual cells: - to merge neighbouring columns in same row set cell.Item(row, col).MergeCell = GridMergeCellDirection.ColumnsInRow - to merge neighbouring rows in same column set cell.Item(row, col).MergeCell = GridMergeCellDirection.RowsInColumn In order to center text within a covered range, you first make it a covered range and set vertical and horizontal alignemnt, e.g. gridControl1.CoveredRanges.Add(GridRangeInfo.Cells(6, 2, 7, 6)) gridControl1(6, 2).VerticalAlignment = GridVerticalAlignment.Middle gridControl1(6, 2).HorizontalAlignment = GridHorizontalAlignment.Center Stefan


MN Mahesh Naik September 24, 2004 10:28 AM UTC

thank you. currently i am a VB dabbler.What namespaces i use? you have given the variables without fully qulified names.? >Hi Mahesh, > >First you need to set >Options.MergeCellsMode = GridMergeCellsMode.OnDemandCalculation|GridMergeCellsMode.MergeRowsInColumn|GridMergeCellsMode.MergeColumnsInRow; > >then for individual cells: > >- to merge neighbouring columns in same row set > >cell.Item(row, col).MergeCell = GridMergeCellDirection.ColumnsInRow > >- to merge neighbouring rows in same column set > >cell.Item(row, col).MergeCell = GridMergeCellDirection.RowsInColumn > >In order to center text within a covered range, you first make it a covered range and set vertical and horizontal alignemnt, e.g. > > > gridControl1.CoveredRanges.Add(GridRangeInfo.Cells(6, 2, 7, 6)) > gridControl1(6, 2).VerticalAlignment = GridVerticalAlignment.Middle > gridControl1(6, 2).HorizontalAlignment = GridHorizontalAlignment.Center > > >Stefan > > >


MN Mahesh Naik September 24, 2004 11:05 AM UTC

cant i have the property assigned to a full column.? a full row?. i have 17 copies of the grid , each with a different number of rows and different text matter in the columns. i want the msflxgrideffect of vb6, > >thank you. currently i am a VB dabbler.What namespaces i use? >you have given the variables without fully qulified names.? > >>Hi Mahesh, >> >>First you need to set >>Options.MergeCellsMode = GridMergeCellsMode.OnDemandCalculation|GridMergeCellsMode.MergeRowsInColumn|GridMergeCellsMode.MergeColumnsInRow; >> >>then for individual cells: >> >>- to merge neighbouring columns in same row set >> >>cell.Item(row, col).MergeCell = GridMergeCellDirection.ColumnsInRow >> >>- to merge neighbouring rows in same column set >> >>cell.Item(row, col).MergeCell = GridMergeCellDirection.RowsInColumn >> >>In order to center text within a covered range, you first make it a covered range and set vertical and horizontal alignemnt, e.g. >> >> >> gridControl1.CoveredRanges.Add(GridRangeInfo.Cells(6, 2, 7, 6)) >> gridControl1(6, 2).VerticalAlignment = GridVerticalAlignment.Middle >> gridControl1(6, 2).HorizontalAlignment = GridHorizontalAlignment.Center >> >> >>Stefan >> >> >>


AD Administrator Syncfusion Team September 24, 2004 11:26 AM UTC

Sure. to assign the value to a column: - to merge neighbouring rows in same column set grid.ColStyles.Item(col).MergeCell = GridMergeCellDirection.RowsInColumn Same with rows using grid.RowStyles.Item(row). Stefam


MN Mahesh Naik September 24, 2004 11:55 AM UTC

thank you, i managed col and row, but what about the option statement on the top. Do i use the or operator instaed of | in VB? and how do i set it in vb i am trying it on a tiny t41 right now..waiting..


MN Mahesh Naik September 24, 2004 12:11 PM UTC

Options.MergeCellsMode = GridMergeCellsMode.OnDemandCalculation|GridMergeCellsMode.MergeRowsInColumn|GridMergeCellsMode.MergeColumnsInRow; what is the fully qualified syntax to set. I drilled down to locate where option as present but i got it only as a readonly property?


AD Administrator Syncfusion Team September 24, 2004 03:04 PM UTC

Mahesh, try grid.Model.Options.MergeCellsMode = GridMergeCellsMode.OnDemandCalculation Or GridMergeCellsMode.MergeRowsInColumn Or GridMergeCellsMode.MergeColumnsInRow Stefan


MN Mahesh Naik September 25, 2004 12:09 PM UTC

Good morning, .no doenot work.. i have a grdcontrol with name msfgsection my statement is with msfgsection .grid.model.option...........=....... it tells me grid id not a memebr of ''syncfusion.Windows.froms.grid.gridcontrol'' how do i reference the parent ? I managed to compile my data entry application just a hr back but without the mer effect.Every row is repeating the question text...


MN Mahesh Naik September 25, 2004 01:40 PM UTC

hello, i manged to get it.Is a grid and gridcontrol the same object?. i just put.model.option.mergecells onthe rhs..., and managed to put through a translation. I am finding the code becoming more dirtier. I have 17 instances. How do i create my own grid based on your grid(by using it a parent and inherting only what the son likes) . I have also to handle 8 different colour styles on all the grids. 2 more remaining glitches, please before i start evaluating the software ... i want to disable sorting,editing and column sizing. Basically i donot want any more properties than waht i got with MSFlexgrid with vb 6,0. My developers had used that .ocx and i [with a lot of patient help from C1] poted it to C1flexgrid. I like your covered cells as it saves me a lot of I/O. 700 Question texts had to be repaeted at each row allocated for the groups of answers for a question. after trial and testing for a next survey [with lots of money only] i may intend to use syncfusion grid though you are missing a zip compatible library in your pocket emptying product.


AD Administrator Syncfusion Team September 25, 2004 07:38 PM UTC

If you are using a GridDataBoundGrid, you can set properties to control the things you mentions. //turn off sorting this.gridDataBoundGrid1.SortBehavior = GridSortBehavior.None; //turn off column sizing this.gridDataBoundGrid1.ResizeColsBehavior = GridResizeCellsBehavior.None; //turn off editing this.gridDataBoundGrid1.Binder.EnableEdit = false;


MN Mahesh Naik September 26, 2004 08:35 AM UTC

I am using a vanilla unbound grid with only 2 events as of now. i handle keydown and rowcol chnage[after change].


MN Mahesh Naik September 26, 2004 09:15 AM UTC

how do i disable editing ? unbound gridcontrol


AD Administrator Syncfusion Team September 26, 2004 09:47 AM UTC

this.grid.ReadOnly = false; will do it. There are several other ways you can do it as well such as handling the grid.CurrentCellStartEditing event and setting e.Cancel = true, or using CellType = "Static" for all your cells (this.grid.TableStyle.CellType = "Static";).


MN Mahesh Naik September 26, 2004 11:29 AM UTC

i mean readonly for the user , not the program. i take the keystrokes and execute them based on my edit logic. I tried readonly but then it makes it readonly even for the program. >this.grid.ReadOnly = false; will do it. > >There are several other ways you can do it as well such as handling the grid.CurrentCellStartEditing event and setting e.Cancel = true, or using CellType = "Static" for all your cells (this.grid.TableStyle.CellType = "Static";).


AD Administrator Syncfusion Team September 26, 2004 10:55 PM UTC

You still use grid.ReadOnly = true. When you want to programatically change something, you first set grid.IgnoreReadOnly = true, make teh change from code, and then set grid.IgnoreReadOnly = flase to trun the readonly back on for your user.


MN Mahesh Naik September 27, 2004 06:07 AM UTC

may not work. some questions take their feedback from a list of values already listed in column 3.while selecting the arrows take you up and down only within the question boundries. To really run away from the question i use \ char{actually it is user selctable}. for questions like age i actually trap the key strokes within a cell and validate them to be within the acceptable allowed bounds. Either i want the editing switched off or all input to be filtered by me so that i can translate the keystrokes. I want your mercedes car to run like my bullock cart because the road only allows that. Mahesh Naik


AD Administrator Syncfusion Team September 27, 2004 02:02 PM UTC

You are free to design your own custom cell type that handles all aspects of the user''s interaction with a specific cell in keyboard interaction. Take a look at the discussion Deriving a Cell Control in the grid user guide\essentialgrid overview\deriving a cell control. We ship many samples that use custom cell types. Do a search in the grid\samples for CellModels.Add. This will show you more than 20 examples. To handle keystrokes in a custom cell type, you can the techninues discussed in this forum thread. http://www.syncfusion.com/Support/Forums/message.aspx?MessageID=8961


MN Mahesh Naik September 28, 2004 11:06 AM UTC

thank you .I was excatly doing that right now. that is only thing pendig for me to learn about the relevant ideas about your grid . I will come back after a couple of days.

Loader.
Up arrow icon