gettting value from javascript

Posted by Shoyebaziz123 under ASP.NET on 3/16/2010 | Views : 1265 | Status : [Member] | Replies : 4
Hi all;

i have use this function for confirmation

function confirm_delete()
{
if (confirm("The checked file(s) will be deleted?")==true)
return true;
else
return false;
}

but how can i get that user has pressed Ok or Cancel Button .....i ma using C# .


Thanks in advance




Responses

Posted by: Syedshakeer on: 3/16/2010 [Member] Starter

Up
0
Down
Hi,
use the following code
<script type="text/Javascript" language ="javascript" >

function confirm_meth()
{
if( confirm("Do you want to continue!Click 'YES'")==true)
{
document.writeln ("<b>You had clic on 'YES' Button</b>");
}
else
{
document.writeln ("<b>You had clic on 'NO' Button</b>");
}
}

<asp:Button ID="btnconfirm" runat="server"  Text="Confrimation MsgBox" 

OnClientClick =" return confirm_meth()" Width="160px" />


Syed Shakeer Hussain

Shoyebaziz123, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sagarp on: 3/17/2010 [Member] Bronze

Up
0
Down
<script language='javascript' type='text/javascript'>

function test()
{
if (Validation fails)
{
return false;
}
else
{
return true;
}
}
</script>

<asp:Button onclientclick="return test();' runat="server" id="butSubmit" text="submit" />


Thanks
SagarP
http://www.emanonsolutions.net
http://emanonsolutions.blogspot.com/

Shoyebaziz123, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: SurajRane on: 3/17/2010 [Member] Starter

Up
0
Down
This function will return you Ok if ok button is pressed else it will return Cancel.

function confirm_delete() 

{
return (confirm("The checked file(s) will be deleted?"))? "Ok":"Cancel";
}



Shoyebaziz123, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Gttejas on: 3/18/2010 [Member] Starter

Up
0
Down
function confirm_meth()
{
if( confirm("Do you want to continue!Click 'YES'")==true)
{
return true;
}
else
{
return false;
}
}
<asp:Button ID="btnconfirm" runat="server" Text="Confrimation MsgBox"
OnClientClick =" return confirm_meth()" Width="160px" />

if User Press 'yes' then postback will occur otherwise not.

Please mark this as answer if it solove

Shoyebaziz123, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response