You have to change your design. In your current code there is no instance of dialog1 at all when you execute dialog2.