RadContext menu Item selected problem

2 posts, 0 answers
  1. Pardha Saradhi
    Pardha Saradhi avatar
    28 posts
    Member since:
    Jul 2010

    Posted 25 Nov 2010 Link to this post

    I have a created a RadContext Menu under button click, then it will open "Contains","NotContains"....etc items.When i select any of the item from the list,then that particular item need to be highlighted/should change to bold. when i click on 2nd time on the button then the previous selected item should show by highlighting of that item.
    bellow is the my code.






    <asp:ScriptManager ID="ScriptManager" runat="server">






    <asp:Button ID="btnFilterName" runat="server" CssClass="rgFilter" Text="Show Menu"



    OnClientClick="showMenuFirstName(this, event);return false;"






    <telerik:RadContextMenu ID="RadContextMenuFirstName" runat="server" OnClientItemClicked="applyFilterFirstName">






    <telerik:ContextMenuControlTarget ControlID="btnFilterName"/>









    <telerik:RadMenuItem Value="CONTAINS" Text="CONTAINS"/>



    <telerik:RadMenuItem Value="DOESNOTCONTAIN" Text="DOESNOTCONTAIN" />



    <telerik:RadMenuItem Value="EQUALTO" Text="EQUALTO" />



    <telerik:RadMenuItem Value="NOTEQUALTO" Text="NOTEQUALTO" />



    <telerik:RadMenuItem Value="STARTSWITH" Text="STARTSWITH" />



    <telerik:RadMenuItem Value="ENDSWITH" Text="ENDSWITH" />



    <telerik:RadMenuItem Value="ISNULL" Text="ISNULL" />



    <telerik:RadMenuItem Value="NOTISNULL" Text="NOTISNULL" />









    <telerik:RadScriptBlock ID="RadScriptBlockFstName" runat="server">



    <script type="text/javascript">



    function showMenuFirstName(btn, e) {



    "btnFilterName", "RadContextMenuFirstName")).show(e);





    function applyFilterFirstName(sender, args) {




    var menu = $find("<%=RadContextMenuFirstName.ClientID %>");












    Thanks in advance.
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 29 Nov 2010 Link to this post


    You can try the following clientcode to achieve your requirement.

    function applyFilterFirstName(sender, args)
                      var menu = $find("<%=RadContextMenuFirstName.ClientID %>");
                      index = args.get_item().get_index();
                      for (var i = 0; i < menu.get_items().get_count(); i++)
                          menu.get_items().getItem(i)._element.style.backgroundColor = "White";
                          if (index == i)
                              menu.get_items().getItem(index)._element.style.backgroundColor = "Yellow";

Back to Top