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

Access item through index.

1 Answer 31 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Jane
Top achievements
Rank 1
Jane asked on 13 Aug 2013, 05:34 PM
Hi Telerik,

I am about to replace the asp datagrid in my page with radgrid and there I frequently used indexes to access the grid items and found telerik grid rarely use the same approach in samples available over the internet. So is there any disadvantages of using index in telerik radgrid apart from asp gridview. In such a case i need to alter a major portion of my code.

Thanks and Regards,
Jane.

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 14 Aug 2013, 03:29 AM
Hi Jane,

Telerik RadGrid has a property called UniqueName of string type which provides a reliable way of locating the cell in a particular column. This property is assigned automatically at design time. For example, an auto-generated GridBoundColumn with DataField 'ContactName' generates a UniqueName of 'ContactName'.

One of the major differences between RadGrid and the standard .NET DataGrid control is the dynamic column structure of RadGrid. Unlike the MS DataGrid, RadGrid supports operations such as column reordering and grouping at client which alter the Cells collection of GridItem objects in a way that can’t be predicted by the page developer. But imagine that the user has changed the column order using client-side drag/drop. Then the cell with index 4 will no longer refer the same field value. That's why RadGrid provides the ability to access cells in items using the corresponding column’s UniqueName. For example, if you have a column with the unique name "CustomerID" you can find the corresponding cell in a GridItem even if the column is reordered at client and hence it is always preferable to use UniqueName instead of index.

Thanks,
Shinu.

Tags
General Discussions
Asked by
Jane
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or