RadGrid for ASP.NET

RadGrid Send comments on this topic.
SelectedIndexes Property
See Also  Example
Telerik.WebControls Namespace > RadGrid Class : SelectedIndexes Property


Gets a collection of indexes of the selected items.   

 

Namespace: Telerik.WebControls
Assembly: RadGrid (in RadGrid.dll)

Syntax

Visual Basic (Declaration) 
Public ReadOnly Property SelectedIndexes As GridIndexCollection
Visual Basic (Usage)Copy Code
Dim instance As RadGrid
Dim value As GridIndexCollection
 
value = instance.SelectedIndexes
C# 
public GridIndexCollection SelectedIndexes {get;}

Return Value

returns GridIndexCollection of the indexes of all selected Items.

Example

You can see an example usage of this property in the following online example:

http://www.telerik.com/r.a.d.controls/Grid/Examples/Hierarchy/ThreeLevel/DefaultCS.aspx

Setting the selected index prior to binding r.a.d.grid:
C#Copy Code
If the index is in a detail table, parent items will be expanded automatically ">private void Page_Load(object sender, EventArgs e)
   {
      
if (!IsPostBack)
      {                
         RadGrid1.SelectedIndexes.Add(1, 0, 1, 0, 1);
         
//Index of 1, 0, 1, 0, 1 means:
         
//1 - item with index 1 in the MasterTabelView
         
//0 - detail table with index 0
         
//1 - item with index 1 (the second item) in the first detail table
         
//0 - 0 the third-level detail table
         
//1 - the item with index 1 in the third-level table
      }
   }
    
Setting the selected index prior to binding r.a.d.grid:
Visual BasicCopy Code
If the index is in a detail table, parent items will be expanded automatically ">Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
   If Not IsPostBack Then
      RadGrid1.SelectedIndexes.Add(1, 0, 1, 0, 1)
      'Index of 1, 0, 1, 0, 1 means:
      '1 - item With index 1 In the MasterTabelView
      '0 - detail table With index 0
      '1 - item With index 1 (the second item) In the first detail table
      '0 - 0 the third-level detail table
      '1 - the item With index 1 In the third-level table
   End If
End Sub
Setting the selected index prior to binding Telerik RadGrid: If the index is in a detail table, parent items will be expanded automatically
C#Copy Code
private void Page_Load(object sender, EventArgs e)
   {
      
if (!IsPostBack)
      {                
         RadGrid1.SelectedIndexes.Add(1, 0, 1, 0, 1);
         
//Index of 1, 0, 1, 0, 1 means:
         
//1 - item with index 1 in the MasterTabelView
         
//0 - detail table with index 0
         
//1 - item with index 1 (the second item) in the first detail table
         
//0 - 0 the third-level detail table
         
//1 - the item with index 1 in the third-level table
      }
   }
    
Setting the selected index prior to binding Telerik RadGrid: If the index Is In a detail table, parent items will be expanded automatically
Visual Basic