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
410
Focused rows not identifiable.
posted

Hi all,

I want to set the colors for each 7th row to red (background) and white (foreground) using the code as follows:

                    this.UltraWebGrid1.Rows[row].Style.ForeColor = System.Drawing.Color.White;
                    this.UltraWebGrid1.Rows[row].Style.BackColor = System.Drawing.Color.Red;


The  grids styles is SelectType.Single, the selected row should be peachpuff (background) and blue (foreground):

            this.UltraWebGrid1.DisplayLayout.CellClickActionDefault = Infragistics.WebUI.UltraWebGrid.CellClickAction.RowSelect;
            this.UltraWebGrid1.DisplayLayout.SelectedRowStyleDefault.BackColor = System.Drawing.Color.PeachPuff;
            this.UltraWebGrid1.DisplayLayout.SelectedRowStyleDefault.ForeColor = System.Drawing.Color.Blue;
            this.UltraWebGrid1.DisplayLayout.SelectTypeRowDefault = Infragistics.WebUI.UltraWebGrid.SelectType.Single;
 

Actually setting the rows color works fine but the selected rows are not idenficable because their color isn't changed when being selected.

Am I missing somthing or is there any  way to get my code run as intended?

Many thanks for helping and sharing thoughts in advance!

Regards

Martin

 

 

 

 

 

  • 45049
    posted

    Without looking into this in great detail, my first suspicion is that you may have the concept of a "selected row" confused with that of an "active row".

    The "active row" of WebGrid is either the row that has focus, or the row that contains the cell that has focus.  WebGrid can have either one active row or no active row at any one time.

    By comparison, WebGrid may be configured to allow "selected rows."  Check the DisplayLayout.SelectTypeRowDefault property to see if your whole gird allows row selection, or an individual band's SelectTypeRow property to see if the default is overridden for a particular band.  You can configure the grid to allow no row selection, single row select, or multiple row selection.  In your selection, you're allowing single row selection across the entire grid.  The grid may have no, one, or many selected rows at any one time.

    Style information for active rows and for selected rows is kept separate.  If a row is both active and selected, the active row style takes precedence.