Welcome Guest Search | Active Topics | Sign In | Register

ContextMenu and Asynchronous callback Options
teq sa
Posted: Thursday, April 2, 2009 6:00:18 AM
Rank: Newbie
Groups: Member

Joined: 9/30/2008
Posts: 9
I have 1 simple aspx page with a ScriptManager (MS AJAX), a textbox (INPUT HTML tag), a contextmenu (EO) linked to textbox and a button (INPUT HTML tag).
After page loading all works well, textbox has his contextmenu at right click.
When user press the button, the page makes an asynchronous call to server (XMLHTTPREQUEST) and a callback function handle the response, replacing textbox object with the one received in responseText.
Now, after replacing the textbox (DOM function removeChild and function appendChild), contextMenu isn't yet functioning. When I right click the textbox, standard contextMenu appears but not my defined EO contextMenu.

I think that when replacing html object i've to reinitialize the EO control but how can I do this?
Have you an idea to make this possible?

Thanks!

eo_support
Posted: Thursday, April 2, 2009 9:00:03 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

You won't be able to do it this way. Once you replace the textbox, the context menu is still connected to the old textbox so it won't work. The easiest way is to replace your AJAX call with an ASP.NET UpdatePanel or our CallbackPanel, then let them to do the update for you. The key is to also place the context menu inside the panel, so that when you update the textbox, the context menu is also being updated (re-initialized).

Thanks!
teq sa
Posted: Thursday, April 2, 2009 9:13:27 AM
Rank: Newbie
Groups: Member

Joined: 9/30/2008
Posts: 9
Sorry but I managed to do this calling "_eo_initObj_contextMenu()" function and re-declaring the event handler (right click) of the textbox. In this way, after replacing the texbox I can have contextMenu working well.

Is this correct?
Can you confirm me that _eo_initobj_contextMenu() is the function for initialize context menu. Can I use this function safely?

I managed also changing contextMenu items on server side, during callback, and having updated contextMenu on client after callback handler function.
eo_support
Posted: Thursday, April 2, 2009 9:19:55 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

You can do that but we won't support this because the name of the function may changes in future versions. The CallbackPanel also does some additional work such as ensuring proper clean up, those interface are not exposed for user code to call.

Another option for you is to call eo_ShowContextMenu instead of setting the ContextMenu's ContextControlID. eo_ShowContextMenu is a documented function and it will not change.

Thanks!
teq sa
Posted: Thursday, April 2, 2009 9:52:12 AM
Rank: Newbie
Groups: Member

Joined: 9/30/2008
Posts: 9
I understand it. I think that the best method would be use eo_ShowContextMenu function, but i need to know if there is a chance to change contextMenu elements such adding a customItem,deleting a menu entry or renaming a menu entry. Maybe there's a clientside API function working on menu?
eo_support
Posted: Thursday, April 2, 2009 10:01:50 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

Updating the context menu would be a separate question than showing it. The supported method is again using a CallbackPanel or an UpdatePanel. With our CallbackPanel, you can call eo_Callback to trigger the update. I believe you can do the same with UpdatePanel but with a different JavaScript call, please refer to ASP.NET AJAX documentation for details on that. Since you are already showing context menu with eo_ShowContextMenu, you only need to include the menu, not the textbox in the CallbackPanel/UpdatePanel. Basically whenever you wish to AJAX update any of our controls, you put it inside a CallbackPanel/UpdatePanel control.

Thanks
teq sa
Posted: Thursday, April 2, 2009 10:07:50 AM
Rank: Newbie
Groups: Member

Joined: 9/30/2008
Posts: 9
Ok I will use an EO Callback panel. I think that this would be the most suitable solution for my problem.
Many thanks for your quickly answers, EO Customer Support is really efficient!

Thanks!!!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.