Java Yes/No Alert

Eduardo Lorenzo

Regular
Joined
Jun 27, 2006
Messages
87
right now I use this

Page.RegisterStartupScript("errorscript", "<script> alert('Account Number not Valid!');</script>")

as a messagebox/warning.
But what I want is to be able to display a Yes/No type alert and capture the choice for server-side processing.
I know that this is possible.. I just don't know how.

can anyone please help me.
 
Hello,

User the javascript Confirm() messagebox. You should be able to capture the YES/NO and decide accrodingly.

Some sampel from web -

<SCRIPT language="JavaScript">
<!--
function go_there()
{
var where_to= confirm("Do you really want to go to this page??");
if (where_to== true)
{
window.location="http://yourplace.com/yourpage.htm";
}
else
{
window.location="http://www.barbie.com";
}
}
//-->
</SCRIPT>



HTH.
 
Hi Jitesh and thank you very much.

I have tried this option but that I want to do is to execute some ServerSide code (ASP.Net) depending on the choice.

I have also tried to reference an object on the page - a hidden textbox, and it works "fine"

I really want to find a way for me to catch the choice using server side code.
 
You can write the javascript code to get the page submitted back to the server and there you can do the further processing. Something like-

document.FormName.submit();

Please check for the correct syntax.

HTH.
 
Back
Top