I know there are a lot of questions like this one, but I can't find the right answer.
I have a button on my asp.net page:
<asp:LinkButton ID="lbReset" runat="server" CssClass="lbReset" OnClientClick="return ShowDialog();" ToolTip="Restart your session as if you would just have logged in">Restart</asp:LinkButton>
I have this div for the dialog content:
<div id="dialog" title="Restart" style="display: none;">
<p>This will clear all data of the current session (as if you would have just logged in)!</p>
<p>Are you sure?</p>
</div>
I have this script for the javascript part:
<script type="text/javascript">
$("div#dialog").dialog({
modal: true,
closeOnEscape: false,
autoOpen: false,
buttons:
{
"Yes": function () { $("div#dialog").dialog("close"); callback(false); }
, "No": function () { $("div#dialog").dialog("close"); callback(true); }
}
}).prev().find(".ui-dialog-titlebar-close").hide();
function ShowDialog() {
return $("div#dialog").dialog("open");
}
function callback(value) {
return value
}
</script>
If I use a simple confirm box, I can stop the button from executing the code-behind when the user clicks no. I want this dialog to have the same behaviour. But it doesn't matter on which button you click, yes or no, the code-behind is executed anyway.
What am I doing wrong here?
rg. Eric