Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
255
Add a Column AND Row header to a grid in cardview mode
posted

Hi everyone,

I'm relatively new to the WinGrid component, and I couldn't seem to find a solution to something I'm trying to do. Suppose I have a datatable with information about the monitor setup for computers. The computers will have a maximum of 2 monitors. The datatable columns are arranged as such:

Manufacturer_Monitor1
Manufacturer_Monitor2
DisplaySize_Monitor1
DisplaySize_Monitor2
RefreshRate_Monitor1
RefreshRate_Monitor2

 

What I would like to do is create a Ultragrid Cardview that has Monitor1 and Monitor2 as Column headers and the various specs as Row headers. Such as:

 

Monitor1 Monitor2
Manufacturer Sony Acer
Display Size 15" 17"
Refresh Rate 60 Hz 120 Hz

 

 

Monitor1 Monitor2
Manufacturer Acer Acer
Display Size 19" 19"
Refresh Rate 60 Hz 60 Hz

I was able to get the row headers to work. I created a group for each row and added the appropriate fields to the group. However I'm stuck on the column header part. Is there any way to do this?

 

Thanks in advance.

Parents
No Data
Reply
  • 469350
    Suggested Answer
    Offline posted

    Well, if you are using Groups to create the row headers, then what you could do is create another group with no caption (I think you'd have to use a single space character, actually) and add two unbound columns to it. These two unbound columns would act as column headers. Of course, they would appear as normal cells, by default, but you could use the column's CellAppearance to make the text bold and give them a more header-like appearance by setting the BackColor and ForeColor. Then all you have to do is populate every cell in these unbound columns with the same text.

    The InitializeLayout event is a good place to set up the unbound columns. And then I would use InitializeRow to populate the Value of each cell in those columns.

Children
No Data