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. Image for the cookie policy date
close icon

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

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


3 Replies

AR Akila Rajaram Syncfusion Team 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                



FF fff 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



AR Akila Rajaram Syncfusion Team 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                

Loader.
Live Chat Icon For mobile
Up arrow icon