I am trying to change the color of a Row based on a value, which works perfectly. Except I need to change the row above this row as well, and this works on the first refresh of the grid, but subsequent refreshes it doesn't work because e.Row.Index is not the index but -1.
This is the code I am using:
Me.grd_Main.Rows(e.Row.Index - 1).Appearance.BackColor = cClosedControllerBlue
Any ideas why it works the first time and not subsequently?
Thanks
M
Hi All,
This is still happening even more than eight years after it was reported. I modidied class frmExternalSummaries in CSharpSamplesExplorer solution and added an event handler to UltraGrid InitializeRow event. I added one statement in my event handler:
Trace.WriteLine(string.Format("InitializeRow - band: {0}, row: {1}", e.Row.Band.Index, e.Row.Index));
I got the following output:
InitializeRow - band: 0, row: -1InitializeRow - band: 1, row: -1InitializeRow - band: 1, row: -1InitializeRow - band: 1, row: -1InitializeRow - band: 1, row: -1InitializeRow - band: 1, row: -1InitializeRow - band: 0, row: -1
Is there a workaround to suppress these?
Thanks,Shaolin
If you can duplicate this in a sample, then I recommend submitting the issue to Infragistics Developer Support so they can check it out. Maybe there is some reason why a row would have an Index of -1, but if so, the reason escapes me. Sounds like a bug.
Get Help
Hi Mike,
put an if statment e.Row.IsDataRow, for me -1 index returns the FilterRow, but since you use the OutlookGroupBy then propably the e.Row is an UltraGroupByRow instead UltraGridRow
Hope that Helped
Nassos
I have narrowed it dow with some sample code, it is an OutlookGroupBy issue.
These two lines of code cause the problem to reproduce. I can send you the simple 50 lin project that reproduces it, if that helps.
Me.UltraGrid1.DisplayLayout.Bands(0).SortedColumns.Add("SortValue", False, True)
Thanks again.
That is the crazy part, it is actually -1, I had to put a check in because it was crashing with a -2 once I subtracted 1.
I had to look in the documentation to try and figure out what a -1 meant, of course it doesnt exist. That's how I ended up here.
If I can reproduce it in a simpler sample project, would that be of value in figuring it out?
Thanks for following up on this, I greatly appreciate your help.