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.
OR
2) Write JavaScript (to open the popup window) on
OnClientClick
of the button. The last line of the function would be
return false;
function openPopup()
{
...
window.open(\"url\");
return false;
}
And call this function this way:
<asp:Button ID="Button1" runat="server" Text="Button" OnClientClick="return openPopup()" />
Hope this helps!