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

Get a GridDataItem given its itemIndexHierarchical at the server side

1 Answer 46 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Hind
Top achievements
Rank 1
Hind asked on 06 Oct 2011, 01:25 PM
Hello,

I have a hierarchical grid. At the client side, i have the following OnRowContextMenu event    

function RowContextMenu(sender, eventArgs) {
        document.getElementById(lblRowIndex").value = eventArgs.get_itemIndexHierarchical();
        document.getElementById(rdMethodClickedTableId").value = this.UID; 
    } 
this function allow to save the index of the grid item associated to the context menu.
On other hand, I have a server side  event RdDocumentMenu_ItemClick fired by  the  RadcontextMenu click.
<ItemTemplate>
 <telerik:RadContextMenu runat="server" ID="MenuDocument" Skin="WebBlue" EnableRoundedCorners="true" EnableShadows="true" EnableViewState="true" OnItemClick="RdDocumentMenu_ItemClick" OnClientItemClicking="OnDocumentMenuClicking">
        <Items>
               <telerik:RadMenuItem Text="ManageDesignProcess.editstep.lblMnuItemDocumentEdit" Value="Edit" ImageUrl='~/Images   
                /menu/menu_sub.gif' ImageOverUrl='~/Images/menu/over/menu_sub.gif'/>
         </Items>
 </telerik:RadContextMenu>
</ItemTemplate>
And In this function,i want to retrieve the GridDataItem by giving its index that it was saved in the lblRowIndex text field.

    protected void RdDocumentMenu_ItemClick(object sender, RadMenuEventArgs e)
    {
        string sDocumentClickedRowIndex;
        string sUId;
        sDocumentClickedRowIndex = lblRowIndex.Text;
        sUId = rdMethodClickedTableId.Text;
 
        GridTableView tableView = this.Page.FindControl(sUId) as GridTableView;
        GridDataItem dataItem = tableView.Items[sDocumentClickedRowIndex]; (??)
}

How can I do it?

Thank You,

1 Answer, 1 is accepted

Sort by
0
Accepted
Jayesh Goyani
Top achievements
Rank 2
answered on 06 Oct 2011, 01:54 PM
Hello,

protected void RdDocumentMenu_ItemClick(object sender, RadMenuEventArgs e)
    {
RadMenu RdDocumentMenu=  sender as RadMenu;
GridDataItem item = RdDocumentMenu.NamingContainer as GridDataItem;
// item.FindControl("Lable1") as Label; // find label from current grid
//item.OwnerTableView.ParentItem.FindControl("Lable1") as Label; // from parent Grid



Thanks,
Jayesh Goyani
Tags
Grid
Asked by
Hind
Top achievements
Rank 1
Answers by
Jayesh Goyani
Top achievements
Rank 2
Share this question
or