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 : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

getting cell value, knowing its RowIndex & ColIndex in a GridDataControl ?

Thread ID:

Created:

Updated:

Platform:

Replies:

116337 May 16,2014 06:38 AM UTC May 27,2014 05:26 AM UTC WPF 3
loading
Tags: GridDataControl
fff
Asked On May 16, 2014 06:38 AM UTC

I see that with many other types of SF grids, but not with GriddataControl.

The other methods do not work with GDC.

Help please or link to what I missed or FAQ for that control ?

Thanks,

Fab


Akila Rajaram [Syncfusion]
Replied On May 19, 2014 01:21 PM UTC

Hi  Fab,

                            

You can access the CellValue of the particular cell by using gird.Model[Rowindex, Columnindex].CellValue property as in the below code snippet,

 

private void Button_Click_1(object sender, RoutedEventArgs e)

        {

            var cellValue = this.grid.Model[3,3].CellValue;

           MessageBox.Show(" cellvalue\t" + CellValue);

      }

 

 

In another way, you can access the underlying data of the particular row based on rowindex by resolving to RecordIndex. From RecordIndex, you can access the data from Model.View.Records (If not Grouped) / Mode.View.TopLevelGroup.DisplayElements (if Grid is grouped) as in the below code snippet,

 

private void Button_Click_1(object sender, RoutedEventArgs e)

        {

            var recordindex = this.grid.Model.ResolveIndexToRecordPosition(5);

            Student stud;

            if (grid.Model.Table.HasGroups)

            {

                var displ = this.grid.Model.View.TopLevelGroup.DisplayElements[recordindex];

                if (displ.IsRecords)

                    stud = (this.grid.Model.View.TopLevelGroup.DisplayElements[recordindex] as RecordEntry).Data as Student;

            }

            else

                stud = this.grid.Model.View.Records[recordindex].Data as Student;

        }

 

Please let us know if you have any questions.

 

Regards,

Akila                


fff
Replied On May 22, 2014 04:06 PM UTC

Thanks Akila .

Looks stupid question, but was not in any SF forum or help page.

And thanks to give complementary answer and other example !

BR,

Fab


Akila Rajaram [Syncfusion]
Replied On May 27, 2014 05:26 AM UTC

Hi  Fab,

 

Thanks for your update. Please  let us know if you have any queries. We will always happy to assist you.

 

Regards,

Akila                

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.

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

;