We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Iterate over selected rows and change their cell values

Thread ID:

Created:

Updated:

Platform:

Replies:

149472 Nov 27,2019 07:58 AM UTC Nov 28,2019 02:19 PM UTC WPF 1
loading
Tags: SfDataGrid
Michal
Asked On November 27, 2019 07:58 AM UTC

For example, my SfDataGrid looks like this:

idnamebool
1asdftrue
2fdsafalse
3qwertrue

I want to add a button that will change all currently selected rows' "bool" column to "true". How do I do this? I couldn't find anything related in the documentation.

Mohanram Anbukkarasu [Syncfusion]
Replied On November 28, 2019 02:19 PM UTC

Hi Michal,   
  
Thanks for contacting Syncfusion support.    
  
Your requirement to change the values of a specific column for all the selected rows on a button click can be achieved as shown in the below code example.   
  
Code example:    
  
private void Button_Click(object sender, RoutedEventArgs e)   
{   
    foreach(var item in this.dataGrid.SelectedItems)   
    {   
        if (!(item as EmployeeInfo).IsAvailable)   
            (item as EmployeeInfo).IsAvailable = true;   
    }   
}   
  

 
 
We have prepared a sample using the above code example to replicate your scenario and it is available in the below link for your reference.   
  
  
  
Please let us know if you require further other assistance from us.    
  
Regards,   
Mohanram A  



CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon