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

c# winforms sfDataGrid multiple selected cells

Thread ID:

Created:

Updated:

Platform:

Replies:

143887 Apr 9,2019 11:13 AM UTC Apr 12,2019 04:31 AM UTC WinForms 3
loading
Tags: SfDataGrid
Matt
Asked On April 9, 2019 11:13 AM UTC

Hello,

i have the following code which gives me the value in cell 0 of the selected row.

            string idtoapp;
            var selectedItem = sfDataGrid3.SelectedItems[0];
            var dataRow = (selectedItem as DataRowView).Row;
            idtoapp = dataRow["id"].ToString();

i wish to use multiple selection and return all values of cell 0 from the rows that are selected.

your help would be mostly appreciated.

Many Thanks

Matt 





Jagadeesan Pichaimuthu [Syncfusion]
Replied On April 10, 2019 06:37 AM UTC

Hi Matt, 

Thanks for using Syncfusion product. 

You can able to get the all 0th column value of the selected rows by using the below code snippet, 

List<string> items = new List<string>(); 
 
if (sfDataGrid1.SelectedItems.Count > 0) 
{ 
    foreach (var item in sfDataGrid1.SelectedItems) 
    { 
        var dataRow = (item as DataRowView).Row; 
        string selectedItem = dataRow[0].ToString(); 
        items.Add(selectedItem); 
    } 
} 


If we misunderstood your requirement, please provide more information regarding the requirement. This would help us to proceed further. 

Regards, 
Jagadeesan

Matt
Replied On April 11, 2019 02:57 PM UTC

Hello,

This was perfect 

Thank you so much. 

Jagadeesan Pichaimuthu [Syncfusion]
Replied On April 12, 2019 04:31 AM UTC

Hi Matt, 
 
Thanks for your 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, 
Jagadeesan

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