I have a control that has an attribute like this
OnClientClick="checkfn( resultfn(boolval) )"
checkfn goes and displays a modal confirmation. And returns the results in resultfn(boolval) as either true or false.
How do I make OnClientClick take that value and return it. Eg. if resultfn(boolval) = true, then i want it to post back to the server, if it is false, i want to cancel.
UPDATE:
this is what checkfn does at the moment. See below.
function checkfn() {
$("#dialog-confirm").dialog({
resizable: false,
height: 140,
modal: true,
buttons: {
Continue: function () {
$(this).dialog("close");
return true;
},
Cancel: function () {
$(this).dialog("close");
return false;
}
}
});
}
This doesn’t work because checkfn is not waiting for the dialog-confirm box before it returns something. So my idea is that I would like to put things in Continue and Cancel functions to return to resultfn(boolval) a bool which onclientclick can use.
You can’t make the JavaScript function called in
OnClientClick“return” the value to the server, but you can populate a hidden input in the form so that in your server-side click handler, you can read the value: