I am writing the following Javacript code on button click event in
asp.net
<SCRIPT language="JavaScript">
function verify(source, arguments){
msg = "Are you absolutely sure that you want to submit this form?";
if (confirm(msg))
{
arguments.IsValid=true;
}
else
{
arguments.IsValid=false;
}
}
</SCRIPT>
I am tieing with the asp.net code behind page as
public void ValidateBtn_OnClick(object sender, EventArgs e)
{
if (Page.IsValid)
{
lblOutput.Text = "Page is valid.";
}
else
{
lblOutput.Text = "Page is not valid!";
}
}
But it doesn't work.
It always retuns true even if i select cancel from the confirm message.
What is wrong in the code?