Grid item?

2 posts, 0 answers
  1. Saad
    Saad avatar
    82 posts
    Member since:
    Oct 2008

    Posted 07 Dec 2008 Link to this post

    I want to put a invisible menu named 'options' on each row of my grid. When user brings mouse over that, it should get visible and gets invisible again on mouseOut. And a small menu drops out by click that 'option'. How to do that using javascript and how to know that what option has been selected at client side?
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 08 Dec 2008 Link to this post

    Hi Saadi,

    Subscribe for OnRowMouseOver="ContextMenuShow" for the clientevents of RadGrid in order to show the context menu. Then check which item is clicked in onclicentclick event of RadContextMenu. You can try following code snippet to achieve the desired scenario.

    ASPX:
    <telerik:RadContextMenu ID="RadMenu1" runat="server" Skin="Vista" onclientitemclicked="ItemClicked">  
        <Items> 
              <telerik:RadMenuItem Text="Options" > 
              <Items> 
                    <telerik:RadMenuItem runat="server" Text="Option 1" Value="1">  
                    </telerik:RadMenuItem> 
                    <telerik:RadMenuItem runat="server" Text="Option 2" Value="2">  
                    </telerik:RadMenuItem> 
              </Items> 
              </telerik:RadMenuItem> 
        </Items> 
    </telerik:RadContextMenu> 

    JavaScript:
    <script type="text/javascript">  
    function ContextMenuShow(sender, eventArgs)  
    {  
        var menu = $find("<%=RadMenu1.ClientID %>");  
        var evt = eventArgs.get_domEvent();  
        menu.show(evt);  
    }  
    function ItemClicked(sender, eventArgs)  
    {  
        var menu = $find("<%=RadMenu1.ClientID %>");  
        var temp= eventArgs.get_item().get_value();  
        if (temp==1)  
            alert("Clicked Option 1");  
        else 
            alert("Clicked Option 2");  
    }  
    </script> 


    Thanks,
    Princy.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top