Is there a way to present two level headers. meaning as in the image below my first level header is Personal Info and Money Info and the second level header is name, age and so on.
When the user scrolls both should scroll, basically they both are header bands
Mihail,
I was posting a code example for the original question since it appears that I failed to correctly answer the original question of the topic ;-) Giving code example for row layouts is pretty tricky since there is alot that you can do with row layouts and it can be very specific to how you want each one set up, and the code that is generated to position all the cells isn't necessarily particuarly helpful to just read if you haven't done any design-time work with them before. I would recommend playing around with the Row Layout Designer to get a feel for this first. What you could do is follow the steps I mentioned above, but instead of ensuring that 'Use Groups and Levels' is selected, you'd have 'Use Row Layout'. You would also need to create an unbound column for each of the upper-level headers that you'd need. Once you're in the designer, you can drag the columns that you want to be on the second row under the first-row column, then set the SpanX of that main column accordingly (in my case 8 to span 4 columns). Since you don't care about the data of this unbound columns (as you likely won't have any), you'd want to hide the associated cells. To do this, right-click on the header and set the label position to "Label Only".
The reason that I say that it's easier to use the designer to learn this is because otherwise you'd have to manually calculate/set all the OriginX/OriginY and SpanX/SpanY, or other properties individually, and it's much easier to do so with the visual designer. I'm pretty sure that there's also a sample of using row layouts that ship with the SDK for NetAdvantage.
-Matt
Matt:
Thanks for the reply. Sorry, by code example I meant the other way (row layout example). Somebody posted a link for an example but is an obsolete one, in 6.x version. If there is an example for row layout link I will appreciate a link to it or some kind of code.
Thanks, Mihail
You are right, I completely misread the original post when I saw "two level headers", meaning multiple levels of headers for the same group (figures that I'd overcomplicate it in my head :-) ). Yes, this can simply be done by creating as many groups as necessary and just adding each column to the group. To the OP, this can be done in the grid's designer by going to Band and Column Settings ->Band -> Column Arrangement Overview, ensuring that "Use Groups and Levels" is selected, and clicking the "Design Column Arrangement Now" button, assuming that your data schema is known at design time. If you don't know this at design-time, you can create the group off of the Groups collection on the band and then adding a column to it, such as:
UltraGridBand band = this.ultraGrid1.DisplayLayout.Bands[0];UltraGridGroup group = band.Groups.Add("Group 1", "Group Caption");group.Columns.Add(band.Columns[0]);
Why cannot you use Groups Headers fort this? I am having a similar situation (in my case the group header that I add is just "grouping" one header for each group). Maybe this (1 to 1) let me do it via group headers? Anyway could you give a code example for what you are saying? That will help a lot.
Thanks,
Mihail
I don't think that there is any way to do this via Groups and Levels, but you should be able to accomplish this using row layouts. You would basically have to have "Personal information" and "Money information" be unbound columns set to LabelOnly, then set them to span across those columns.