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
195
Can a column have diff't captions for each group?
posted

Hi.  I have a grid that has a date column which can have slightly different meanings based on the group. I would like to dynamically change the caption based on which group it is in but I'm not having much luck.  I am changing this in the InitializeGroupByRow event now but it changes the caption for the entire grid.  Is this possible?

Here is the code that isn't working for me...

void gdApplicantCases_InitializeGroupByRow(object sender, InitializeGroupByRowEventArgs e)
{
 if (e.Row.Value.Equals("IA"))
     e.Row.Band.Columns["AppDate"].Header.Caption = "Intake Date";
 else if (e.Row.Value.Equals("AA"))
     e.Row.Band.Columns["AppDate"].Header.Caption = "Application Date";
...
}

Parents
  • 469350
    Offline posted

    Hi,

    You can't do it this way - the Band here is a backward pointer to the Band that the row is in and they are all in the same band.

    The only way to do something like this would be to use a DrawFilter or a CreationFilter to modify the text of the UIElements in the grid. I'd use a CreationFilter, myself. You could trap for the HeaderUIElement for the column, then use GetContext on it to get a RowsCollection or possibly a Row. Then from there you could get the parent row and examine it to determine what the header text should be. Then you have to find the TextUIElement inside the ChildElements collection of the HeaderUIElement and set it's Text.

Reply Children