CellButton enable/disable

Hello,
I have several CellButtons in a cell in the grid. How can I enable/disable them individually? 

M. 

3 Replies 1 reply marked as answer

MA Mohanram Anbukkarasu Syncfusion Team April 9, 2021 12:18 PM UTC

Hi Martin, 

Thanks for contacting Syncfusion support.  

You can enable/disable specific buttons in a GridButtonColumn cells conditionally by using SfDataGrid.QueryButtonCellStyle as shown in the following code example.  

Code example :  

this.sfDataGrid1.QueryButtonCellStyle += SfDataGrid1_QueryButtonCellStyle; 
 
private void SfDataGrid1_QueryButtonCellStyle(object sender, Syncfusion.WinForms.DataGrid.Events.QueryButtonCellStyleEventArgs e) 
{ 
     if (e.Button.Text == "Button2" && e.RowIndex % 4 == 0) 
     { 
         e.Style.Enabled = false; 
     } 
} 

 


Please let us know if you require further assistance from us.  

Regards, 
Mohanram A. 


Marked as answer

MA Martin Aupperle April 9, 2021 02:36 PM UTC

Ah! It's in the *Style* ! Thank you!

Best,
Martin



MA Mohanram Anbukkarasu Syncfusion Team April 12, 2021 06:06 AM UTC

Hi Martin, 

Thanks for the update.  

We are glad to know that the provided solution worked at your end. Please let us know if you have any further queries on this. We are happy to help you. 

Regards, 
Mohanram A. 


Loader.
Up arrow icon