grid contextmenu, pass row value

2 posts, 0 answers
  1. Christian
    Christian avatar
    65 posts
    Member since:
    Apr 2008

    Posted 20 Mar 2011 Link to this post

    I need to get a value from a griddatabound datafield and pass it on to my context menu events.
    at the moment i only get the index, is there any way to do this? can i somehow store the selected value in the input field and retreive it from the radmenu clicked event?

    function RowContextMenu(sender, eventArgs)
        var menu = $find("ctl00_phContent_RadMenu1");
        var evt = eventArgs.get_domEvent();
        if( == "INPUT" || == "A"
        var index = eventArgs.get_itemIndexHierarchical();
        document.getElementById("radGridClickedRowIndex").value = index;
        sender.get_masterTableView().selectItem(sender.get_masterTableView().get_dataItems()[index].get_element(), true);
        evt.cancelBubble = true;
        evt.returnValue = false;
        if (evt.stopPropagation)

        <ClientSettings AllowDragToGroup="True">
            <ClientEvents OnRowContextMenu="RowContextMenu">
        <Selecting AllowRowSelect="true" />

    <input type="hidden" id="radGridClickedRowIndex" name="radGridClickedRowIndex" />
        <telerik:RadContextMenu ID="RadMenu1" runat="server" OnItemClick="RadMenu1_ItemClick"
            EnableRoundedCorners="True" EnableShadows="True">
                <telerik:RadMenuItem Text="Öppna ärende" />
                <telerik:RadMenuItem Text="Avsluta ärende" />
                <telerik:RadMenuItem Text="Ta bort ärende" />

    protected void RadMenu1_ItemClick(object sender, RadMenuEventArgs e)
            int radGridClickedRowIndex;
            radGridClickedRowIndex = Convert.ToInt32(Request.Form["radGridClickedRowIndex"]);

  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 21 Mar 2011 Link to this post

    Hi Christian,

    In the client side event handler, get reference to coresponding cell and get the innerHTML as shown in the Telerik documentation.
    Now set the HiddenField value (radGridClickedRowIndex) accordingly.

Back to Top