Dear All,
I have JQuery confirmation dialog function that called by server side code (C#)
how to get its return value of that function? in this case the return value would be either Yes or No..
please help
Thanks a lot in advance & Regards
Win
I called it in button clicked event as below:
Code:
protected void btn1_Click(object sender, EventArgs e)
{
string message = "Message from server side, please select yes or no";
ClientScript.RegisterStartupScript(this.GetType(), "Popup", "ShowConfirmation('" + message + "');", true);
}
my question is how to get JQuery return value, in this case the return value would be Yes or No?
Code:
=== JQuery Confirmation Dialog ==
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script src="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.9/jquery-ui.js" type="text/javascript"></script>
<link href="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.9/themes/start/jquery-ui.css"
rel="stylesheet" type="text/css" />
<script type="text/javascript">
function ShowConfirmation(message) {
$(function () {
$("#dialog").html(message);
$("#dialog").dialog({
title: "Please Confirm",
buttons: {
Yes: function () {
alert('yes');
$(this).dialog('close');
}, No: function () {
alert('no');
$(this).dialog('close');
}
},
modal: true
});
});
};
</script>