How to get the confirmation of Yes/No from a javascript pop-up and display the value on the page

Platform: ASP.NET|Category: Client Side Scripting

Code Behind

Button1.Attributes.Add('onclick', 'getMessage()')

Client Side

<SCRIPT language=javascript>
function getMessage() 
{ 
var ans; 
ans=window.confirm(’Is it your confirmation.....?’); 

if (ans==true) 
	{ 
		document.Form1.hdnbox.value=’Yes’; 
	} 
else 
	{ 
		document.Form1.hdnbox.value=’No’;} 
	} 
</SCRIPT>

To display the Yes/No value selected by user, in your code behind file:

Response.Write(Request.Form('hdnbox'))