Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx_beginners thread: Javascript confirm method


Message #1 by "ekta agarwal" <enahar@h...> on Wed, 18 Sep 2002 14:03:55
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?


  Return to Index