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
600
Getting a cell when OutlookGroupBy is on
posted

Dear all,

I have an issue related to the ViewStyleBand property OutlookGroupBy in an UltraGrid and trying to retrieve a cell. Based on the value on one cell I want to en/disable another cell in the same row.

So in the AfterCellUpdate event I have:

if (e.Cell.Column.Key == <Column Where I Make the Edit>)

{

    bool set = e.Cell.Value.ToString() == "ValueOfInterest";

    UltraGridRow row = ultraGrid.DisplayLayout.Rows[e.Cell.Row.Index];

    row.Cells[<Column Key Where I Want the Knock On Effect>].Activation = set ? Activation.AllowEdit : Activation.Disabled;

}


This works fine unless I have ViewStyleBand = OutlookGroupBy, in which case row.Cells is null.

Any ideas how I can get round this? I'm sure it's simply but searching this forum and using Google hasn't helped.

Thanks


Parents
  • 469350
    Offline posted

    Hi,

    This is wrong:

    UltraGridRow row = ultraGrid.DisplayLayout.Rows[e.Cell.Row.Index];

    This line of code is weird for a number of reasons, but basically, you are making a bad assumption that the row you are dealing with is at the root level of the rows collection. If your grid is grouped, then the root-level rows are the GroupByRows, which, of course, have no cells.

    Anyway, this is very easy to solve. The line of code you have here is getting the Row and then using the Index of that row to index into the rows collection to get the row you already have. Just skip all that and use the Row you already have.

    UltraGridRow row = e.Cell.Row;

Reply Children
No Data