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
5549
InitializeRow and find right Cell
posted

Private Sub My_InitializeRow(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinGrid.InitializeRowEventArgs) ' Handles UltraWebGrid1.InitializeRow
   
       e.Row.Cells(2).Style.BackColor = Drawing.Color.Red

 

hi, in my InitializeRow Event i want set the backcolor of a cell to red. but how can i find the right cell, if the grid is dynamic build?

in above code it is the cell 2 but it could be 5 oder 3

each column has its own key

 

  • 5118
    Suggested Answer
    posted

    Just read through your post again...

    Are you using WinGrid? or WebGrid?

    The stub says wingrid but the handles says webgrid. 

    WebGrid would be e.Row.Cells.FromKey("MyColumnKey").Style.BackColor = Drawing.Color.Red

  • 5118
    posted

    There are overloads to get into the Cells collection so you can do

    e.Row.Cells("MyColumnKey").Style.BackColor = Drawing.Color.Red.

    You might want to see if you can use ConditionalFormatting if you are just setting styles for certain cells (Conditional Formatting).