This is a migrated thread and some comments may be shown as answers.

selected and current properties

3 Answers 107 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Erez
Top achievements
Rank 1
Erez asked on 18 Jun 2009, 01:18 PM
Hello,

Can anyone please tell me what is the difference between the following properties on a telerik grid?
The help system (chm\web) does not give sufficient information on this matter.

1) SelectedItem

2) SelectedRecord

3) SelectedRecords

4) CurrentCell

5) CurrentItem

6) CurrentRecord

Thanks,

Erez

3 Answers, 1 is accepted

Sort by
0
Accepted
Stefan Dobrev
Telerik team
answered on 19 Jun 2009, 09:11 AM
Hello Erez,

Here is a brief overview of each property:

1) SelectedItem
This property points to the currently selected date item. For example if you bind the grid to let say list of customers and click on the first row, this property will be set to the first customer.

2) SelectedRecord
This one holds the currently selected record. Records are abstraction we are currently creating for each item in the data source. In most cases this will be DataRecord which holds the SelectedItem. Our advice is not to use this property, because in a future version we may obsolete it.

3) SelectedRecords
Similar to SelectedRecord, but holds a collection of selected records if MultipleSelect is set true.

4) CurrentCell
Holds the cell, which is currently focused. If you hit F2 you will start to edit this cell.

5) CurrentItem
Data item which is currently focused.

6) CurrentRecord
DataRecord which is currently focused.

Hope this helps.

All the best,
Stefan Dobrev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Erez
Top achievements
Rank 1
answered on 29 Jun 2009, 06:17 AM

Hello,

I came across the following post:
http://www.telerik.com/community/forums/wpf/gridview/how-set-selected-on-row-from-source.aspx

It points out the use of:
this.radGridViewSelection.SelectedRecords[0].IsSelected = false;  

In this current post (not the aforementioned) you wrote:
2) SelectedRecord
This one holds the currently selected record. Records are abstraction we are currently creating for each item in the data source. In most cases this will be DataRecord which holds the SelectedItem.
Our advice is not to use this property, because in a future version we may obsolete it.


How do the two fit toghter and what do you recommand as an alternative

for checking for a selected record ?

Thanks,

Erez

0
Milan
Telerik team
answered on 29 Jun 2009, 09:47 PM
Hello Erez,

Basically the SelectedRecords collection stores all selectred record, while the SelectedRecord property gives access to the last item of the SelectedRecords collection.

There are many possible way to check if a record is selected - the most straightforward one is to inspect the IsSelected property of a given record. If the property is true than the record is selected. Alternatively you can use the SelectedRecords collection and do the following: this.RadGridView1.SelectedRecords.Contains(recordToCheck).

Best wishes,
Milan
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
GridView
Asked by
Erez
Top achievements
Rank 1
Answers by
Stefan Dobrev
Telerik team
Erez
Top achievements
Rank 1
Milan
Telerik team
Share this question
or