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

TreeView & ContextMenu & PostBack

3 Answers 107 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Gilles
Top achievements
Rank 1
Gilles asked on 01 Apr 2016, 11:12 AM

Hi, sorry my english isn't very good, hope you understand.

I have a treeview with a contextMenu. In the contextMenu I have an item that needs some javascript to run and a confirmation to know if postback must be triggered.

Something like this :

- user right-click on a node (contextMenu appears)

- user select menu item

- javascript stop postback (I used "args.set_cancel(true);" in the javascript)

- javascript runs some functions then a "modal window" is displayed (this is not a window.confirm !!!) with a message like "Are you sure ?" and the usual buttons "yes/no"

My problem, how do I re-enable (or resume, or resend) the "postback" like if the menu item was clicked ?

I've already done something like this on a RadButton, and simply by using "sender.click()" in the javascript, the postback is "resumed". But there are no functions like this on a contextMenu I think...

 

3 Answers, 1 is accepted

Sort by
0
Gilles
Top achievements
Rank 1
answered on 01 Apr 2016, 11:26 AM
After some more research, I can get the menuItem and perform a click in my javascript (menuItem.click()) but nothing happens... no postback... what am I missing ?
0
Gilles
Top achievements
Rank 1
answered on 01 Apr 2016, 12:30 PM
Finally... of course my javascript was in onClientContextMenuItemClicking, but when I fired "menuItem.click()" it cames back in onClientContextMenuItemClicking... 
Problem solved (perhaps not the best way.. but solved...)
0
Accepted
Ivan Danchev
Telerik team
answered on 05 Apr 2016, 01:41 PM
Hello Gilles,

The MenuItem's click() method is the correct method to use if you want to invoke a click. This will fire the corresponding events (ItemClicking including) as if the Item is clicked with the mouse. You can find more information on the MenuItem object's client-side methods in the following documentation article.

Regards,
Ivan Danchev
Telerik
Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
Tags
TreeView
Asked by
Gilles
Top achievements
Rank 1
Answers by
Gilles
Top achievements
Rank 1
Ivan Danchev
Telerik team
Share this question
or