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

Getting Row and/or DataKeyValues on Server Side given ItemIndexHierarchical

3 Answers 46 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Kenny
Top achievements
Rank 1
Kenny asked on 13 Nov 2014, 11:34 PM
I am trying to make the drag and drop from a tree view put the dragged content into the appropriate section of a hierarchical grid (adjacent to the row it was dropped on).

I am capturing the itemIndexHierarchical of a row in the OnRowMouseOver event on the client.  I am saving this in a hidden field so that I can look up the row in some server code (the event handler for the tree view drop event). 

How can I get the row and or dataKeyValues given the itemIndexHierarchical key?  Surely there is a server side call that can do this for me, am I missing something?

Thanks,
Kenny Long

3 Answers, 1 is accepted

Sort by
0
Accepted
Marin
Telerik team
answered on 18 Nov 2014, 06:11 PM
Hello,

Each GridItem also has an ItemIndexHierarchical property on the server which you can use the find the corresponding item on the server-side. You can iterate through the Items collection of the control and see which one matches the saved hierarchical item index value from the client.

Regards,
Marin
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Kenny
Top achievements
Rank 1
answered on 18 Nov 2014, 09:22 PM
Thanks for the response Martin, is there a sample of how to iterate through the items in a Heirarchical grid?  Also, what is the property in the grid that holds the ItemIndexHierarchical value.

Thanks in advance!
Kenny
0
Kenny
Top achievements
Rank 1
answered on 18 Nov 2014, 10:13 PM
Hi Martin, a little poking around and I figured it out.  I am including the code snippet here to help someone else who may need this:

            if (e.HtmlElementID == RadGrid1.ClientID)
            {

                foreach (GridDataItem item in RadGrid1.MasterTableView.ItemsHierarchy)
                {
                    String s = item.ItemIndexHierarchical;
                    if (s.Equals(gridDropIndex))
                    {
                        String key = item.KeyValues;
                    }
                }
Tags
Grid
Asked by
Kenny
Top achievements
Rank 1
Answers by
Marin
Telerik team
Kenny
Top achievements
Rank 1
Share this question
or