I am trying to set a row activate/selected in order to show the default selected row color of light brown
foreach (UltraGridRow oDr in this.dgVersions.Rows) {
if (Convert.ToString(oDr.Cells["Version"].Value.ToString()) == GlobalParams.oldVrsno.ToString() && GlobalParams.oldVrsno > 0) {
this.dgVersions.Rows[i].Selected = true;
this.dgVersions.Rows[i].Activate();
this.dgVersions.ActiveRow = oDr; }
i++; }
As you see in thesccrenshot i am trying to highlight the 2 row of the bottom grid
If none of those properties are working, then my guess is that you are setting the properties and then something else in your code is overriding them. You should check to see if you are setting those properties somewhere else in your code or loading a Layout, a Preset, or a Style Library (.isl) file.
The way you word things it sounds as if you're trying to set active and selected rows while trying to achieve a background color of the row.
If you're looking to change the active row's background color you can use the code below for color.
ultraGrid1.DisplayLayout.Override.ActiveRowAppearance.BackColor = Color.Tan;
In addition, if you want the same color to be used should a user select multiple rows you can do that with a similar line of code like above.
ultraGrid1.DisplayLayout.Override.SelectedRowAppearance.BackColor = Color.Tan;
I tried all the three selected, activate & activerow one at a time as well but no luck. the two grid are not connected. the reason i sent the top grid was to show the color which I am trying to get for a selected row in to bottom one.
Hi,
I'm not sure I understand what you are trying to do.
The code you have here appears to be looping through the grid and examining each row. If it finds a row that meets the criteria, you are selecting the row, and then activating that row, and then activating it again.
You cannot have more than one active row at a time. So it seems like you should just be selecting the row, not setting the active row.
I'm also confused by the screen shot you posted here. Why are there two grids displayed here? Is this a parent band with a child band? Or two completely different grid controls?
The default highlight color for selected or active rows in the grid is not brown. So where is this brown color coming from? Are you setting a SelectedRowAppearance? Or an ActiveRowAppearnace? Or are you loading a Style Library (.isl file) into your application?