In your code behind write:
Button2.Attributes.Add("onclick","return ShowData();");
Button3.Attributes.Add("onclick","return ClosePopup();");
Add the following script in the head section of your aspx page:
<script language="javascript" type="text/javascript">
function ShowData()
{
var txtValue = document.getElementById("TextBox2").value;
alert(txtValue);
return false;
}
function ClosePopup()
{
alert('Close button clicked.');
return false;
}
</script>
Remember, the ID of your TextBox has to be the ID generated in HTML(view source of your page for client ID) since it is inside a panel. It may change. Alternatively, you can use Control.ClientID property in JavaScript.