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

Dynamic ContextMenu

4 Answers 133 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Pash
Top achievements
Rank 1
Pash asked on 31 Mar 2008, 09:41 AM
Hi.

Context menu is required for images binded in  repeater (e.g. with items Delete, Move, Send).
For this purposes i need to create separate menus for every image (with value as image id) or there is another better way to do it?

Thanx in advance.

4 Answers, 1 is accepted

Sort by
0
Erjan Gavalji
Telerik team
answered on 31 Mar 2008, 10:49 AM
Hi Pash,

You can define a wrapper element around the repeater and attach the context menu to it. Then you can use the OnClientShowing client event to determine if the context menu was opened by clicking on an image and cancel the event if not.

Please, find attached a small page demonstrating this approach.

Let me know if this helps.

Kind regards,
Erjan Gavalji
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Pash
Top achievements
Rank 1
answered on 31 Mar 2008, 12:41 PM
It's not very clear about this approach how to cal server-side event (onclick) and transfer arguments.
I thouht about the way to create ContextMenu for each image, set value (as image id) and do server side onclick event.
But i can see  only client-side events in examples, if server-side events works fine in ContextMenu?
0
Erjan Gavalji
Telerik team
answered on 31 Mar 2008, 01:36 PM
Hi Pash,

Of course, you can define a context menu that will be bound to a server-image in the repeater. Please note, that this will cause a the creation of many RadContextMenus on the page, which could lead to reducing the page load time. I prepared a new sample demonstrating this approach.

Let me know if that helps.

Kind regards,
Erjan Gavalji
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Pash
Top achievements
Rank 1
answered on 31 Mar 2008, 01:45 PM
Yes, i tried this way to implement but i was a bit worried about speed in case of many menus on page.
Anyway if i meet some speed problems - i will write.

thanx for answers
Tags
Menu
Asked by
Pash
Top achievements
Rank 1
Answers by
Erjan Gavalji
Telerik team
Pash
Top achievements
Rank 1
Share this question
or