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
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.
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).