[Solved] How to get dataColumn at special Column with condition CheckboxColumn is checked?

I have 2 active forms, base form1 includes datagrid is set databinding is datatable contains checkbox column.
From form 2, I want to get data from column A in form 1 if the column checkbox is checked. 
(If I use a filter, maybe I need to save the view datagrid earlier so after the filter I need to return the original view but I'm not sure if this is a good solution)
What should i do in this case?

3 Replies

SS Susmitha Sundar Syncfusion Team April 29, 2020 02:36 PM UTC

Hi GridLock, 
 
Thank you using Syncfusion controls. 
 
You can get the column values from another form based on GridCheckBoxColumn value by using SfDataGrid.View.GetPropertyAccessProvider(). 
 
private void Form2_Load(object sender, EventArgs e) 
 { 
     dataGrid.View.RecordPropertyChanged += View_RecordPropertyChanged; 
     foreach (var data in dataGrid.View.Records) 
     { 
         var propertyCollection = this.dataGrid.View.GetPropertyAccessProvider(); 
         var DataRow = (data.Data as DataRowView).Row; 
         var checkValue = propertyCollection.GetValue(DataRow, "IsChecked"); 
         if(checkValue.ToString() == "True") 
         { 
             var cellValue = propertyCollection.GetValue(DataRow, "EmployeeName"); 
             this.richTextBox1.Text = richTextBox1.Text + "\n" + cellValue.ToString(); 
         } 
          
     } 
 } 
 
 
 
 
Please let us know if you need further assistance on this. 
 
Regards, 
Susmitha S 



TG The GridLock April 29, 2020 10:05 PM UTC

Hi Susmitha,
This is exactly what I need !


SS Susmitha Sundar Syncfusion Team April 30, 2020 04:51 AM UTC

Hi GridLock, 
 
Thanks for the update. 
 
We are glad to know that the reported problem has been resolved at your end. Please let us know if you have any further queries on this. We are happy to help you. 
 
Regards, 
Susmitha S 


Loader.
Up arrow icon