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

GDBG & Multi-Row Column Headers

Hello, I have a question about the GDBG and multiple row column headers. My grid is readonly and uses a DataTable as the DataSource. How can I create the column headers so that from top to bottom the grid has: a) 1 or more header rows which span the entire visible portion of the grid and the text is centered on the visible portion of the grid b) 1 column header row which behaves exactly like a normal column header (ie. column selection works like it does in a default grid) -- all rows in the column below the selected column header cell get selected c) 1 or more "data rows", from the data table assigned to the grid''s data source Essentially what I''d like to do is "insert" some additional header rows above the default column headers in a GDBG. While retaining the selection behavior of the default column headers which are no longer the top most row of the grid. The MultiHeader example does not do quite what I need in terms of the column selection. Thank you for any help. -Peter

8 Replies

AD Administrator Syncfusion Team August 24, 2004 07:25 PM UTC

How about this. Drop a panel on your form where you now have the grid. Anchor/dock this panel like you have the grid anchored/docked. Then drop a label onto the panel and dock it to the top. Size it and place the Text in label that you want centered above the grid. Then drop the grid on the panel and set its Dock = Fill. Will this give you the look you want?


AD Administrator Syncfusion Team August 24, 2004 07:27 PM UTC

Here is a forum thread that has a usercontrol sample that implements this idea so you can use it from the designer. http://www.syncfusion.com/Support/Forums/message.aspx?MessageID=3945


PZ Peter Zaborski August 24, 2004 07:43 PM UTC

Hi Clay, Thank you for the idea. Your proposed solution will work as far as the screen display of this grid goes. Where it will fall short of my needs is when I want to prin the grid or copy it to the clipboard. Then I will have to handle the custom label myself. However, I gather from your suggestion that doin what I need would not be trivial using just the GDBG? Would any of the other grids handle this if I take care of populating the cells manually? Since it''s a readonly grid I don''t necessarily need the data binding as much as this "formatting" type stuff. Any further ideas most welcome. -Peter


AD Administrator Syncfusion Team August 24, 2004 08:00 PM UTC

You can easily have row 0 be a solid, single cell into which you put a single string. All you need to do is to make it a covered cell, grid.CoveredCells.Add(GridRangeInfo.Cells(0,0,0,grid.ColCount)). You can set grid.Model.Rows.HeaderCount = 1 and grid.Model.Rows.FrozenCount = 1 to have a second row of headers. What you do not get out of this is the standard column selection behavior as that only works on row 0. So, if you need the column selections, this covered cell solution will not work for you. You could use covered cells to print the grid as one unit, and use the panel solution to allow the selections when you are not prinitng. (So when you print, add the extra header and covered cells). If you want to use the panel solution all the time, you can print the label text in a straight forward manner. Here is a KB on printing headers and footers. The same technique could be used to draw a label. http://www.syncfusion.com/Support/article.aspx?id=10376


ME Mikael Ericsson (PhD) September 23, 2004 11:18 AM UTC

Clay, I am in a similar situation but really need multi-row headers where the lowest row provide column selection, sorting (!) etc. Is this possible? Regards, ME


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

Hi, this is a bit advanced ... But if the existing selection mechanism doesn''t do it, you can try to modify it by replacing the exiting Selection MouseController with your own customized version alltogether. The whole implementation of the GridSelectCellsMouseController class could be copy/pasted to your project and you can rename the class name to for example MySelectCellsMouseController. Then you need to register this custom class with the grid and remove the original mousecontroller. Do this as follows: grid.Model.Options.ControllerOptions &= ~GridControllerOptions.SelectCells. MySelectCellsMouseController selectCellsController = new MySelectCellsMouseController(grid); grid.MouseControllerDispatcher.Add(selectCellsController); Now with that custom mouse control in your project you can now modify it to your needs. There might be some references to internal Switches that we use internally for debugging and you will get a compiler error about them you can simply comment out those lines. Stefan


MN Mahesh Naik September 24, 2004 01:13 PM UTC

Good morning, Can i have a midified combolist in a cell. I want a Multiresponse selction. I dont write controls but i will learn to write them if the grid allows .


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

The \Grid\Samples\In Depth\DropDownFormAndUserControlSample sample features a multi-select CheckedListBox. Stefan

Loader.
Live Chat Icon For mobile
Up arrow icon