Although I can find the item-index without issue with server-side binding, I am having a hard time getting the item-index with client-side binding.
I have tried various combinations of args.get_itemIndexHierarchical() with and without get_DataItem but to no avail.
I know this is probably a simple question, any ideas?
Thanks,
Motty
5 Answers, 1 is accepted

on an item select event
eventArgs.get_itemIndexHierarchical(); works
where eventArgs is the 2nd parameter
as in
function ItemsRowSelected(sender, eventArgs) {
where it is called
<ClientSettings>
<Selecting AllowRowSelect="true" />
<ClientEvents OnRowSelected="ItemsRowSelected" />
</ClientSettings>

function EL_OnRowDataBound(sender, args) {
.....
var boothOnClickData = 'document.location.href = "B.aspx?BoothID=' + intBoothID + '&FromPage=' + location.pathname
+ '&IndexInList=' + args.get_itemIndexHierarchical();
.....
}
This doesn't seem to work even though for the Selected event it does work.
Thanks,
Motty

Telerik.Web.UI.GridDataItemEventArgs OnRowSelected Property
![]() |
---|
To get or set property values for client API properties, you must call property accessor methods that are named with the get_ and set_ prefixes. For example, to get or set a value for a property such as cancel, you call the get_cancel or set_cancel. |
This event is fired after row selection.
Fired by |
RadGrid |
Arguments |
id - id of the RadGrid item that has raised the event itemIndexHierarchical - hierarchical index of the item that has raised the event gridDataItem - the corresponding data item tableView - owner TableView of the item that has raised the event dataKeyValues - data key value for the item that has raised the event domEvent - dom event that was raised for the current event |
the rowDataBound does not
Telerik.Web.UI.GridDataItemEventArgs OnRowDataBound Property
![]() |
---|
To get or set property values for client API properties, you must call property accessor methods that are named with the get_ and set_ prefixes. For example, to get or set a value for a property such as cancel, you call the get_cancel or set_cancel. |
This event will be raised for each grid item which is about to be bound on the client. Can be used to modify/extract the data from the respective row cells or apply custom formatting to some of the cells based on their values.
Fired by |
RadGrid |
Arguments |
dataItem - the underlying data item object (equivalent to e.Item.DataItem object inside ItemDataBound on the server) item - the GridDataItem client instance which is about to be bound |
|

I can see that the documentation does not seem to point to a way to the row/item index on rowdatabound.
However, it seems weird that this would not be available in some format through the API.
If there is no API implementation, I will have to create my own counter to track the item index.
Thanks for the assistance!
Motty
You could achieve your scenario by declaring a global variable that will track the item index. In the RowDataBound event handler iterate the variable each time as it is shown in the example below. Note that you could reset the itemIndex in the RadGrid OnDataBound client-side event.
<
ClientEvents
OnRowDataBound
=
"OnRowDataBound"
OnDataBound
=
"OnDataBound"
/>
var
itemIndex = 0;
function
OnRowDataBound(sender, eventArgs)
{
//your code logic here
itemIndex++;
}
function
OnDataBound(sender, eventArgs)
{
itemIndex = 0;
}
Greetings,
Antonio Stoilkov
the Telerik team