Clicking the button "Change" in Page2.aspx does a postback. At this time NO QueryString is passed. The following methods will solve your issue:
1) I think you are iterating through QuesryString collection. Do a check for null before doing that.
of the button. The last line of the function would be
And call this function this way:
<asp:Button ID="Button1" runat="server" Text="Button" OnClientClick="return openPopup()" />
Hope this helps!