I want to add a button column named "Advanced" only for a particular childband "Programs" of ultrawingrid. Please refer the screenshot.
In ultragrid event AfterRowExpanded , i have hidden the column "Advanced" for all other childbands which are not "Programs".
But i am getting an issue, if the "Programs" band is expanded & then i expand any other band; it will hide the "Advanced" column for "Programs" band also(since that is expanded).
Now collapse all the bands, open any band other than "Programs" , "advanced" column will be hidden. Keep this band expanded, and then expand "Programs" band; "Advanced" column will be shown in programs band as well as the previous expanded band also where this column is not needed.
Please suggest some solution for this.
Thank You
Hi Chritra
The column is a member of the band and the band applies to every child row. There's no way to have a column in a band that only appears under some child rows and not others.
One potential solution would be to create a DataSource with 2 child bands. The two bands would have the same columns except one would have the Advanced column and the other would not. Then when you populate the data, most of the parent row would have child rows in the normal band and no child rows in the "Advanced" band. And only one parent row would have child rows in the "Advanced" band and none in the normal band. Of course, this may not be possible for you depending on your data source and it creates some extra work when coding as you have to account for both child bands.
Another option would be to use a CreationFilter to hide the "Advanced" column. The CreationFilter could hide the UIElements for the cells and headers in that column, but it cannot reclaim the space. So this would only work if the "Advanced" column was the last column in the band (on the far right). It will not work if "Advanced" is in between two other columns like you have it here.
A third option would be to always show the Advanced column and simply hide or disable the cells. It looks like your Advanced column is just showing a button, so disabling the column would disable the button.
Thank You Mike for the reply.
I have a question . Regarding third Solution, Did you mean On initialization we are showing Advanced button column for all bands but on cell click of advanced we will disable the cell for all bands other than Programs?
And for Second solution, can you please provide sample how can i show Advanced column only for Programs using Creation Filter.
I have attached my code in text file which is called upon initialization of form. In that am adding button columns if they don't exist for the grid.
Chitra Gaikwad said:I have a question . Regarding third Solution, Did you mean On initialization we are showing Advanced button column for all bands but on cell click of advanced we will disable the cell for all bands other than Programs?
To elaborate - what I mean is that you just always show the Advanced column. It displays on every child row, regardless of the parent. But you use the InitializeRow event to hide or disable the Cell where appropriate. You handle InitializeRow, examine the row and it's parent row to determine whether Advanced is allowed. Then you set the Activation or Hidden property on the cell in that row to hide or disable the cell. This will leave an empty space or a disabled button.
Chitra Gaikwad said:And for Second solution, can you please provide sample how can i show Advanced column only for Programs using Creation Filter.
I am attaching a small sample project here to demonstrate this technique. It works very well, as long as the column you are hiding is the last column and you turn off the row borders in the grid.