Hi
I have an issue with the column alignment in multiple bands. I have 4 bands and with similar columns in each band. The columns in multiple bands are all aligned and when resizing a column is one band is also resizing the same column in the other bands.
I need to display the columns in groups(categories). When i created the groups in band1 the cloumns in the other bands are not aligning anymore. I exported the grid in excel and modified it so i can send it. Please help
Hello.
After reading your last post I realized that the sample I provided before did not take the re-sizing of groups into account. You can do that by handling the BeforeGroupPosChanged and AfterGroupPosChanged events.
What you would need to do is check the width of the group in AfterGroupPosChanged and then change the width of each group above or below that. When you resize a group, the grid will extent the width of the last column touching the border of that group; it will not resize all columns within the group evenly. You could do this yourself, but it would be a manual process that would require some code. It would be tricky, but certainly possible.
Sincerely,
CharlieSenior Developer Support EngineerMCTS
Charlie
Thanks for you quick reply. I was doing something very similar to this the other day but ran into some issues. I have corrected them now. Since i have 4 bands i need to set the indentation so the user can expand/collapse. With zero indentation the '+' sign to expand/collapse does not appear.
Basically I am setting the indentation to some constant(like 15) and adjusting this in the column width of the 1st visible column of all bands.
And I need to also set the group width to match with the sum of widths of all visible columns in that particular group. With out adjustting the groups widths the columns are not aligned.
I need to work on resizing the groups meaning when the user resizes the group adjusting all the columns in the group in all bands. Hope i wont run in to more issues.
Thanks again for your help.
I have attached a C# Net Advantage 2010 volume 3 sample that demonstrates how to synchronize column widths among different bands when groups are used. When groups are used the grid can't automatically synchronize their widths because as Brian mentioned a band does not even have to contain a group. It's possible to have groups in band 0 but not in band 1.
Fortunately, the workaround is pretty easy. All you need to do is handle the grids AfterColPosChanged event and get a reference to the column that was just resized. To do that, all you need to do is look at e.ColumnHeaders[0].Column. Then, simp,y set the width of the corresponding column in the other band or bands.
In the sample I created a dataset with two tables. Each table has 6 columns and they all have the same keys for the sake of simplicity. If the column being re-sized is in band 0 then I simply set the width of the corresponding column in band 1 and vice versa. This is a manual process and setting the widths of the various columns in different bands is entirely up to the developer. How easy it will be depends upon the complexity of the column arrangement.
Please let me know if you have any questions.
Sincerely
Hi Brian
Thanks for the reply. Our users really want this feature. I know its not supported out of the box but Is there a roundabout/manual way to achieve this functionality like manulaly adjusting the columns widths to include the width that we be taken up for indentation at different bands...
I am trying several ways but nothing works...
I am creating groups for Band 1, but why cant the child bands also belog to the same group and so the columns can line up...I have tried Rowlevels too...but dosent solve the issue.
The only reason I am creating groups is to show a common header for certain columns that belog to the same category. Instead of creating groups is there any other way to acheive this...
Please suggest
I didn't look at the attached project but I believe the behavior you are looking for is impossible because once the columns are in a group their position is determined by that of the group's, and we can't make assumptions about the size of the groups in other bands (other bands might not even have a group).