This question is locked. New answers and comments are not allowed.
I just downloaded the Q2 2009 and Visual Studio is showing SelectedRecord, CurrentRecord, and a bunch of other "Record" properties as deprecated. Is this new for Q2?
What is the best way, then, to accomplish a task such as setting or getting the current record as in http://www.telerik.com/community/forums/silverlight/gridview/selecting-row.aspx?
When I try to inspect my grid's CurrentItem or SelectedItem, I get "Could not evaluate expression"
4 Answers, 1 is accepted
0
Alan
Top achievements
Rank 2
answered on 06 Jul 2009, 04:20 PM
Also, this returns null now when it used to return the current record:
myGrid.ItemsControl.ItemsGenerator.ContainerFromItem(myGrid.CurrentRecord) as GridViewRow;
0
Hello Alan,
SelectedRecord and CurrentRecord are indeed marked as obsolete in Q2. With the introduction of our new data engine we will no longer need to use wrappers (Record, DataRecord, etc) for the data items that are displayed in RadGridView and we are slowly removing our dependence on those wrappers. Working directly with data items is more natural and straightforward.
We now have twin properties like SelectedItem/SelectedRecord, CurrentITem/CurrentRecord, SelectedItems/SelectedRecords and we encourage users to use SelectedItem, CurrentItem, and SelectedItems instead of their counterparts.
The only difference between a pair of twin properties is that one uses data item (for example customer) and the other one uses Record (wrapper or a customer). If you want to select a certain item you could either use SelectedItem or SelectedRecord. You can take a look at our updated example about selection at the following address - http://demos.telerik.com/silverlight/#GridView/Selection
Another way to designate an item as selected is to use the SelectedItems collection - just add a data item to the collection and it will be selected automatically.
To eliminate the "Could not evaluate expression" message you can try to turn on a feature of Visual Studio - go to Tools -> Options -> Debugging -> General and turn on "Enable property evaluation and other implicit function calls".
Now onto the last question.
It is very strange that ContainerFromItem returns null. Could confirm that the CurrentRecord is not set to null when the call to the method is executed?
Hope this helps. Do not hesitate to write if you have more questions.
Regards,
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.
SelectedRecord and CurrentRecord are indeed marked as obsolete in Q2. With the introduction of our new data engine we will no longer need to use wrappers (Record, DataRecord, etc) for the data items that are displayed in RadGridView and we are slowly removing our dependence on those wrappers. Working directly with data items is more natural and straightforward.
We now have twin properties like SelectedItem/SelectedRecord, CurrentITem/CurrentRecord, SelectedItems/SelectedRecords and we encourage users to use SelectedItem, CurrentItem, and SelectedItems instead of their counterparts.
The only difference between a pair of twin properties is that one uses data item (for example customer) and the other one uses Record (wrapper or a customer). If you want to select a certain item you could either use SelectedItem or SelectedRecord. You can take a look at our updated example about selection at the following address - http://demos.telerik.com/silverlight/#GridView/Selection
Another way to designate an item as selected is to use the SelectedItems collection - just add a data item to the collection and it will be selected automatically.
| grid.Records[index].IsSelected = true; |
| // this can be transformed to: |
| var dataRecord = grid.Records[index] as DataRecord; |
| gris.SelectedItems.Add(dataRecord.Data); |
| // or |
| var dataRecord = grid.Records[index] as DataRecord; |
| gris.SelectedItem = dataRecord.Data; |
To eliminate the "Could not evaluate expression" message you can try to turn on a feature of Visual Studio - go to Tools -> Options -> Debugging -> General and turn on "Enable property evaluation and other implicit function calls".
Now onto the last question.
It is very strange that ContainerFromItem returns null. Could confirm that the CurrentRecord is not set to null when the call to the method is executed?
Hope this helps. Do not hesitate to write if you have more questions.
Regards,
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.
0
sandy pochiraju
Top achievements
Rank 1
answered on 12 Oct 2009, 05:40 PM
hi Milan,
i am trying to export selected rows to excel:
but since SelectedRows is obselete, please suggest another way to accomplish this task.
regards,
sandy
i am trying to export selected rows to excel:
content =
this.wipSampleGridView.ToHtml((wipSampleGridView.SelectedRecords, true);
but since SelectedRows is obselete, please suggest another way to accomplish this task.
regards,
sandy
0
Hello sandy pochiraju,
Our latest service pack for Q2 introduced new versions of the export methods that use items instead of records. If you could update to our latest release you will be able to eliminate the use of records.
All the best,
Milan
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Our latest service pack for Q2 introduced new versions of the export methods that use items instead of records. If you could update to our latest release you will be able to eliminate the use of records.
All the best,
Milan
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.