Dynamic ContextMenu

5 posts, 0 answers
  1. Pash
    Pash avatar
    23 posts
    Member since:
    Oct 2003

    Posted 31 Mar 2008 Link to this post

    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.
  2. Erjan Gavalji
    Admin
    Erjan Gavalji avatar
    1455 posts

    Posted 31 Mar 2008 Link to this post

    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
  3. Pash
    Pash avatar
    23 posts
    Member since:
    Oct 2003

    Posted 31 Mar 2008 Link to this post

    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?
  4. Erjan Gavalji
    Admin
    Erjan Gavalji avatar
    1455 posts

    Posted 31 Mar 2008 Link to this post

    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
  5. Pash
    Pash avatar
    23 posts
    Member since:
    Oct 2003

    Posted 31 Mar 2008 Link to this post

    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
Back to Top