Devexpress - How do I change the button Inside DataGridView automatically

418 Views Asked by At

I need to modify the description of the button name that is inside the datagridview

I'm using DevExpress - WindowsForm - C #

How do I change the button line by line automatically based on the value of my cell "TYPE"?

For example: In the "TYPE" column, when the cell value is "Service" the button displays the description "Receive" and when the cell value is "Expense" the button description appears as "Pay now".

enter image description here

1

There are 1 best solutions below

4
On
foreach (DataGridViewRow dgr in dataGridView1.Rows)
            {

                if (!dgr.IsNewRow)
                {
                    if (dgr.Cells[3].Value=="SERVICE")
                    {
                        dgr.Cells[4].Value = "Receive"; 
                    }
                    else if (dgr.Cells[3].Value == "Expense")
                    {
                        dgr.Cells[4].Value = "Pay now"; 
                    }
                }
            }