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

Context Menu

5 Answers 98 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Kousalya
Top achievements
Rank 1
Kousalya asked on 29 May 2008, 09:11 AM
I want a tick mark to be shown beside the selected item of the context menu.
 

5 Answers, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 29 May 2008, 11:16 AM
Hi Kousalya,

Here is one possible solution:

  <script type="text/javascript">  
    function SetImage(sender, eventArgs)  
    {  
        var menu = sender;  
        //clear image for previously selected item  
         for (var i=0; i< menu.get_allItems().length; i++)  
         {          
           menu.get_allItems()[i].set_imageUrl("spacer.gif");             
         }  
         eventArgs.get_item().set_imageUrl("check.gif");  
    }      
    </script> 
    <telerik:RadContextMenu ID="RadContextMenu1" OnClientItemClicking="SetImage" runat="server"

I have attached the transparent spacer.gif image too.




Greetings,
Peter
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Kousalya
Top achievements
Rank 1
answered on 30 May 2008, 06:48 AM
I have written the code like this
function SetImage(sender, eventArgs)  
    {  
        var menu = sender;  
        //clear image for previously selected item  
         for (var i=0; i< menu.length; i++)  
         {          
           menu.Items[i].imageUrl("spacer.gif");             
         }  
         eventArgs.item.imageUrl("check.gif");  
    }      
becoz if i put menu.get_allItems()  it is sayiing there is no such function.
I am not able to set the image to the item selected.
0
Atanas Korchev
Telerik team
answered on 30 May 2008, 07:29 AM
Hi Kousalya,

You are probably not using RadMenu for ASP.NET Ajax. Please post in the correct forum so we can provide the best solution for your case.

This online example demonstrates how to display a check mark for the clicked item:

Regards,
Albert
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Kousalya
Top achievements
Rank 1
answered on 30 May 2008, 07:58 AM
Hi,

 I am using radmenu,
  Code :

<radM:RadMenu ID="rmTree" IsContext="True" CausesValidation="true" runat="server"

Skin="Outlook" ContextMenuElementID="none" OnClientItemClicking="OnClick" OnItemClick="rmTree_ItemClick" >

<Items>
<radM:RadMenuItem Text="Add">
<Items>
<radM:RadMenuItem Text="Hierarchy" ImageUrl="~\Images\ic_hirarchy.gif" />

<radM:RadMenuItem Text="Country" ImageUrl="~\Images\ic_com_country.gif" />

<radM:RadMenuItem Text="State" ImageUrl="~\Images\ic_com_state.gif" />

<radM:RadMenuItem Text="Building" ImageUrl="~\Images\ic_com_building.gif" />

<radM:RadMenuItem Text="Structure" ImageUrl="~\Images\ic_structure.gif">

</radM:RadMenuItem>

<radM:RadMenuItem Text="Land" ImageUrl="~\Images\ic_land.gif">

</radM:RadMenuItem>

<radM:RadMenuItem Text="Project" ImageUrl="~\Images\ic_project.gif">

</radM:RadMenuItem>

</Items>

</radM:RadMenuItem>

<radM:RadMenuItem Text="Rename" />

<radM:RadMenuItem Text="Activate" />

<radM:RadMenuItem Text="De-Activate" />

<radM:RadMenuItem Text="TransactionType" >

<Items>

<radM:RadMenuItem Text="JobPlan" >

</radM:RadMenuItem>

<radM:RadMenuItem Text="Survey">

</radM:RadMenuItem>

<radM:RadMenuItem Text="All">

</radM:RadMenuItem>

</Items>

</radM:RadMenuItem>

</Items>

</radM:RadMenu>

and the javascript fundtion

function

OnClick(sender, eventArgs)

{

var menu = sender;

 

//clear image for previously selected item

 for (var i=0; i< menu.Items.length; i++)

{

 menu.Items[i].Image= "/Images/spacer.gif";

 }

eventArgs.Items[0].ImageUrl=

"/Images/tick.gif";

 

 

}
I want to set the tick mark functionality only to the subitems of
transaction type in the rad menu

0
Atanas Korchev
Telerik team
answered on 30 May 2008, 08:02 AM
Hi Kousalya,

The example I've sent you earlier demonstrates the required approach. I think you can easily adapt it to support your specific requirements.

Regards,
Albert
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Menu
Asked by
Kousalya
Top achievements
Rank 1
Answers by
Peter
Telerik team
Kousalya
Top achievements
Rank 1
Atanas Korchev
Telerik team
Share this question
or