user3787881
user3787881

Reputation:

How to get a cell value from devexpres grid

I want to obtaining all cell with same name or value. I want to do that because i want to change their style.

Here it is example of my column and cell values:

       INDEX HEROS
        0      BATMAN
        1      SUPERMAN
        2      SPIDERMAN
        3      BATMAN

Suppose I have 1000 rows with about 40 cells names BATMAN. How could I get the value BATMAN and how could I change for example their font .

I tried something like this, but it is poor attempt

     gridview.GetRowCellValue (BATMAN, HEROS)

Upvotes: 0

Views: 806

Answers (1)

helrich
helrich

Reputation: 1310

One way to do this is to implement the GridView's RowCellStyle event handler. This event is fired for each cell, and the arguments (RowCellStyleEventArgs) give you the cell's row, column, and value (amongst other things). If you want to change the formatting of every cell that contains "BATMAN", you would do this:

If e.CellValue.ToString() = "BATMAN" Then
   e.Appearance.ForeColor = Color.Yellow
End If

You can also change the font using e.Appearance.Font, as well as background color, etc. Note that this is just an example, and would fail to format cells containing "Batman", "bATMAN", etc.

Upvotes: 2

Related Questions