This is a migrated thread and some comments may be shown as answers.
RadContext menu Item selected problem
1 Answer 38 Views
This is a migrated thread and some comments may be shown as answers.
Pardha Saradhi
Top achievements
Rank 1
Pardha Saradhi asked on 25 Nov 2010, 03:57 PM


Hi,
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.

<

 

div>

 

 

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

 

 

</asp:ScriptManager>

 

 

<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">

 

 

<Targets>

 

 

<telerik:ContextMenuControlTarget ControlID="btnFilterName"/>

 

 

</Targets>

 

 

<Items>

 

 

<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" />

 

 

</Items>

 

 

</telerik:RadContextMenu>

 

 

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

 

 

<script type="text/javascript">

 

 

function showMenuFirstName(btn, e) {

 

$find(btn.id.replace(

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

 

 

}

 

function applyFilterFirstName(sender, args) {

 

 

 

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

 

}

 

</script>

 

 

</telerik:RadScriptBlock>

 

 

</div>

 


Thanks in advance.

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 1
answered on 29 Nov 2010, 06:07 AM
Hello,

You can try the following clientcode to achieve your requirement.

JavaScript
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";
                      }
                  }
              }

Thanks,
Princy.
Tags
Menu
Asked by
Pardha Saradhi
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 1
Share this question
or