Handle the button click (
alert of JavaScript?) and clear the value from the Session list of variables.
Session["compkgid"] = null;
The main thing is how would you handle the button click, is it ASP.NET Control, is it JavaScript alert box or what? If ASP.NET control, then you can handle the click event on the server-side and add this code in it. Otherwise, if this is JavaScript button then you must send asynchronous (ajax) request to server to clear the Session variable or you can use some form input field to store that state etc.