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.

GDBG & Multi-Row Column Headers

Thread ID:





18146 Aug 24,2004 03:03 PM Sep 24,2004 11:21 AM Windows Forms 8
Tags: GridControl
Peter Zaborski
Asked On August 24, 2004 03:03 PM

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

Administrator [Syncfusion]
Replied On August 24, 2004 03:25 PM

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?

Administrator [Syncfusion]
Replied On August 24, 2004 03:27 PM

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

Peter Zaborski
Replied On August 24, 2004 03:43 PM

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

Administrator [Syncfusion]
Replied On August 24, 2004 04:00 PM

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

Mikael Ericsson (PhD)
Replied On September 23, 2004 07:18 AM

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

Administrator [Syncfusion]
Replied On September 23, 2004 10:40 AM

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

Mahesh Naik
Replied On September 24, 2004 09:13 AM

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 .

Administrator [Syncfusion]
Replied On September 24, 2004 11:21 AM

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


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.