I want to know how to communicate between two dialog component.

My Requirement is:
1. In first dialog component, I have two button called My Buttons and Show.
2. In second dialog componen, I have two buttons, Button1 and Save and one dropdown name Numbers.
3. In first dialog component, when I click on My Button, it should open second dialog component.
4. In Second dialog component, I have to select the Number from dropdown and Click on Button1 it should colour change the button, the values of dropdown and button should store in database once I click on Save button, the second dialog component should close and it should reflect the colour change for My Button.
5. After the colour change of My Button, when we click on Show button, it show should the values from database and show it either as a pop up or a dialog component or a window or anything.

So, Can anyone suggest me how can i start this?
Can I use javascript or Xbasic code or both?

Please provide me links where can I find the solution...

Thanks & Regards,