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
65
On each Row a different style by Cell-Value
posted

Hy all together

Whitch ist the best (shortest) way to format a row when a cell has a assigned value? For example, when the cell in the column Categorie is 3, i like to make the row red. Is the value 2 i like to make the row blue and when te value is 4, i like to have the row in gray.

Is this possible?

Thanks a lot for eany ideas.

Greatings
Scampolo

Parents
  • 65
    Suggested Answer
    posted

    You should be able to do what you want in the grid's InitializeRow event:

     

     

     

     

     

     

     

     

    Protected

     

    Sub grd_InitializeRow(ByVal sender As Object, ByVal e As Infragistics.WebUI.UltraWebGrid.RowEventArgs) Handles grd.InitializeRow

     

     

      Select Case e.Row.Cells.FromKey("Categorie").Value

     

     

      Case 2

         e.Row.Style.BackColor = Drawing.Color.Blue

     

     

      Case 3

         e.Row.Style.BackColor = Drawing.Color.Red

     

     

      Case 4

         e.Row.Style.BackColor = Drawing.Color.Gray

     

     

      Case Else

     

     

          'if want to change default color, do so here

     

     

      End Select

     

     

    End Sub

Reply Children
No Data