Hi Ram,
You can use "subscribe_to_button_event" method if I got your question correctly.
Suppose in the pop up you have two buttons ok and cancel, then you can use this method to assign the code. You have to create two actions before this like OK and CANCEL and pass it to the method.
and to cancel the navigation you can write the code in WDBEFOREACTION method.
I hope this helps you.
Regards,
AkkI