0

I am using c1truedbgrid. I have columns added in the grid with one column having button which is displayed is every row. I need to disable the button in a particular row depending on some business logic. How this can be done?

Robert Harvey
  • 178,213
  • 47
  • 333
  • 501
Sagar
  • 1
  • 1
  • 1
  • 3

2 Answers2

0

I am not sure why there aren't any answer. Its fairly simple. Lets say I want to disable the buttons from those rows where ID is even.

for(int i = 0; i< c1truedbgridobject.Splits[0].Rows.Count; i++)
{
  if(Convert.ToInt32(c1truedbgridobject[i,1].ToString())%2 == 0)
  {
    //Disable here
  }
}

However the disable part is dependent on how you are adding button to a cell. Since add button is referenced to whole column and not to a particular cell. Anyhow using a OwnerDrawCell is also an option.

EDIT:

This seems as a limitation of C1TrueDBGrid. You may use C1FlexGrid as an alternative.

Nilay Vishwakarma
  • 3,105
  • 1
  • 27
  • 48
0

You need to make property of that column as "locked=True" as Below example when you initializing grid.

 C1TrueDbGridName.Splits(0).DisplayColumns("YourColumnNameHavingButton").Locked = True

it will make your row not to be editable